fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> </head> <body> <video id="myVideo" width="320" height="240" controls> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> 您的浏览器不支持 video 标签。 </video> <p>点击按钮添加新的文本轨道。</p> <button onclick="myFunction()">点我</button> <p><strong>注意:</strong>所有主流浏览器都不支持 addTextTrack() 方法。</p> <script> var x = document.getElementById("myVideo"); function myFunction(){ var y = x.addTextTrack("caption"); y.addCue(new TextTrackCue("Test text", 01.000, 04.000,"","","",true)); } </script> </body> </html>
运行结果