Change HTML5 video’s quality from JavaScript

后端 未结 2 1476
星月不相逢
星月不相逢 2021-02-05 10:28

In YouTube, we can change the quality of the video from a dropdown like 360p, 144p, 240p, etc. Can we do the same with HTML5 video element from JavaScript?

2条回答
  •  情深已故
    2021-02-05 10:34

    You want to use the youtube-api with html5-player or you are using video files on your server? if youtube-api, try:

    https://developers.google.com/youtube/iframe_api_reference

    [edit]

    The javascript or actionscript only access different videos, as they do not have exchanged the quality would have to recompile in real time (which is unfeasible).

    Do you happen to be interested, you can use ffmpeg on your server (or before you upload the videos to your desktop) to generate various formats (qualities) of video, you can study the following link: http://ffmpeg.org/trac/ffmpeg/wiki/Creating%20multiple%20outputs

    hope this helps.

提交回复
热议问题