Languages

Menu
Sites
Language
[TV] Multiple <video> Tags on one Page not working

I have a Page that has multiple video elements and I want to play one of them when the app loads. But video.play() doesnt seem to do anything.
It works fine if I just have one video but as soon as I add a second one it stops working.

Here is a really simple example that shows my problem:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <script src="./main.js"></script>
</head>
<body>
    <video src="http://example.com/video1.mp4" width="1920"></video>
    <video src="http://example.com/video2.mp4" width="1920"></video>
</body>
</html>
window.onload = function init() {
    var video = document.querySelector('video');
    video.muted = true;
    video.play();
}

 

Responses

8 Replies
Armaan-Ul- Islam

# If the Scenario is, there will be two videos on app screen and one video will play at initial.

This code worked for me:

 

<body>
    <video src="images/a1.mp4" controls></video>
    <video src="images/a1.mp4" controls></video>
</body>
var init = function () {
    console.log('init() called');

    var videos = document.querySelectorAll('video');
    
    videos[1].muted = true;      // indexing videos[0,1]
    videos[1].play();
};

window.onload = init;

 

Egon Steiner

Did you test this on a TV?

I just noticed that I forgott to mention that this issue only appears when I try it on an actual TV it works fine in the Emulator.

Your solution doesn't seem to work either.

Armaan-Ul- Islam

Did the Code worked in Emulator for the scenario I understood ? I tested it on Emulator, But not in TV.

 

Samsung Developers Site has a Guide for HTML5 Video with Sample Code, You might check them out.

Guide: http://developer.samsung.com/tv/develop/guides/multimedia/common/using-video-element

Sample App: https://github.com/SamsungDForum/PlayerHTML5

 

Tizen have APIs for different sorts of video playing called AVPlay. I would also suggest you to check out the Tizen AVPlay API.

http://developer.samsung.com/tv/develop/guides/multimedia/common/using-avplay

https://github.com/SamsungDForum/PlayerAVPlay

Egon Steiner

Your code worked in the emulator but not on the TV. It seems this issue isn't only for video tags. Audio is also a problem. I tried to play a song over my muted video but as soon as I add the audio tag to the page the video stops working.

I'll look into avplay since it seems to support everything that I need.

Thanks!

Yosi Golan

Hey. did you manged to solve it? i see the same thing. when embeding 2 videos, once one video get played the second one pauses.

does any one has a solution? is it a limitation?

Thanks Yosi

Egon Steiner

No, sorry. I didn't find a real solution. I just found a work around where I didn't need 2 videos on the page.

Armaan-Ul- Islam

I've confirmed the code working in Emulator, But as Egon Steiner shared, it doesn't work out in case of real TV model.
 

Seems Tizen TV doesn't supports two videos at a time, At least not using video HTML tag.

Pavel Mendoza

Egon SteinerArmaan-Ul-Islam. Someone know show two videos at same time using AVPLay?