changing source on html5 video tag

前端 未结 16 1852
既然无缘
既然无缘 2020-11-22 08:31

i\'m trying to build a video player, that works everywhere. so far i\'d be going with:

16条回答
  •  情话喂你
    2020-11-22 09:18

    Your original plan sounds fine to me. You'll probably find more browser quirks dealing with dynamically managing the elements, as indicated here by the W3 spec note:

    Dynamically modifying a source element and its attribute when the element is already inserted in a video or audio element will have no effect. To change what is playing, just use the src attribute on the media element directly, possibly making use of the canPlayType() method to pick from amongst available resources. Generally, manipulating source elements manually after the document has been parsed is an unncessarily[sic] complicated approach.

    http://dev.w3.org/html5/spec/Overview.html#the-source-element

提交回复
热议问题