Does HMTL5 video autoplay work on Samsung Smart TV?

若如初见. 提交于 2019-12-24 02:38:20

问题


I'm trying to get an HTML5 video element to autoplay on a Samsung Smart TV (in the regular browser, not specifically as a TV app, if that makes any difference). Perhaps the autoplay element just doesn't work - I have tried all of the following.

autoplay="true"
autoplay="autoplay"
autoplay=autoplay

The video element will play fine manually (once you have managed to point the cursor on the incredibly tiny play control!)

Has anyone else got this to work?


回答1:


This should work:

<video id="video" src="movie.mp4" autoplay="autoplay" width="320" height="240">
Your browser does not support the video tag.
</video> 

At least the documentation says that: http://www.samsungdforum.com/upload_files/files/guide/data/html/html_2/reference/HTML%20Specification.html#HTML5%20and%20Samsung%20Smart%20TV%20SDK

If the autoplay attribute won't work, still you can start it using JavaScript. Just try to call the play() method:

var myVideo = document.getElementById("video");
myVideo.load();
myVideo.play();


来源:https://stackoverflow.com/questions/13234221/does-hmtl5-video-autoplay-work-on-samsung-smart-tv

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