Does HMTL5 video autoplay work on Samsung Smart TV

2019-07-14 02:26发布

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条回答
Anthone
2楼-- · 2019-07-14 03:21

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();
查看更多
登录 后发表回答