variable speed control for audio playback in the browser?

落花浮王杯 提交于 2019-12-07 18:12:44

问题


Is there a way to change the playback speed of audio in the browser? What is best to accomplish this task, html5 audio, or flash, or something else? Are there any specific libraries that would help with this?


回答1:


Use the Web Audio API.

In the following code I answered your other question.

best way to loop audio in the browser?

Modify the code in my answer above as follows for a playback speed example.

Right below

source.loop = loopOnOff;

add

source.playbackRate.value = 1; // change number to between 0.10 to 10 (or larger/smaller) to test.

You can also run the html audio tag through the web audio api and add effects processing.




回答2:


Interesting question there,

HTMl5 will have player speed control will have speed control..

A couple of noteworthy upcoming features are playbackRate and defaultPlaybackRate. As you can probably imagine, these fellas let us alter the speed and direction of playback. This functionality could be used for fast-forward and rewind functions or perhaps to allow users to tweak the playback speed so they can fit more podcasts into their day.

audio.playbackRate returns 1 at normal speed and acts as a multiple that is applied to the rate of playback. For example, setting playbackRate to 2 would double the speed, while setting it to -1 would play the media backwards. audio.defaultPlaybackRate is the rate at which the audio will play after you pause and restart the media (or issue any event for that matter).


Flash Player may help( but it will be customized one you may create, with stream buffer, you need to define the player speed once buffer has the content to play.

Sound easy but will take a lot effort, Refer VLC opesource for better Idea, its documented with ffmpeg which works with Audio, and works with client software, in browser ti will be heavy, refer Just to have idea.

I hope this may help :)



来源:https://stackoverflow.com/questions/15289999/variable-speed-control-for-audio-playback-in-the-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!