2

I've recently started programming within the Tizen environment and SDK, and I am trying to create a (Samsung)smart-tv application which takes mp4-media links and display those links in form of a video-player, the problem is that whenever I use the html5 video tag, the application takes ages (2-4 minutes) to load, and a lot of the time it doesn't even load at all.

The code has been tested on JsFiddle and locally, and it works perfectly fine there, but whenever I try to execute the same code within the index.html in the Tizen project (which runs in a Samsung TV emulator) it exhibits the behavior I just explained (extremely slow/crashing).

Here are some examples of what I tried:

<html>
    <head>
        <link href="https://vjs.zencdn.net/7.5.4/video-js.css" rel="stylesheet">
    </head>

    <body>
        <video id='my-video' class='video-js' controls preload='auto' 
        width='640' height='264'
        poster="download.jpg" data-setup='{}'>
            <source src='sample.mp4' type='video/mp4'>
            <p class='vjs-no-js'>
                To view this video please enable JavaScript, and consider upgrading to a web browser that
                <a href='https://videojs.com/html5-video-support/' target='_blank'>supports HTML5 video</a>
           </p>
       </video>
       <script src='https://vjs.zencdn.net/7.5.4/video.js'></script>
   </body>
</html>

I have also tried without the use of video-js, I tried only using the video element, but the same result, it would sometimes work, sometimes not, and when it would work, it would take a long time before it actually loaded. According to the documentations, HTML5 is supported, and the use of the video tag is even "encouraged" by the guides they published. I have also tried generating the HTML with javascript and trying to make it work like that, but no luck.

Alex Bravo
  • 1,601
  • 2
  • 24
  • 40
DanZoe
  • 111
  • 1
  • 3
  • 15
  • Why do you need video.js script? Remove it and try again... – burakk May 15 '19 at 21:22
  • @burakk If you cared to read the whole text, I specifically said "I have also tried without the use of video-js, I tried only using the video element" – DanZoe May 16 '19 at 00:21
  • As you are using a development project Tizen do they have an example of implementation. It may not be safe to assume they are more compliant to the standards than say Microsoft. videojs can be used to allow for rtmp encoded video with Http Live Stream protocol to work in a video tag ... https://stackoverflow.com/questions/5858936/html5-live-streaming. ... A browser would not be seeing an rtmp feed which may be going to the TV – Wayne Jun 10 '19 at 02:14
  • To add desktop browsers don't directly support a rtmp encoded video - would be nice if they did as you could stream your smartphone video to a local html5 video tag if they did ... the rtmp is missing the seeking ability; this is resolved by a server such as youtube, breaking the video into small videos where each video is played and the browser does not need to wait for the entire file ... like what you are describing. As if your emulator is emulating for HLS (http live stream). The emulator appears to be expecting an EOF before playing portion of video it has in the buffer and requesting mor – Wayne Jun 10 '19 at 02:29

1 Answers1

0

It could be the video tag implementation of the emulator, codec, etc. I assume that you can't test the code on an actual Tizen TV device so I would suggest adding the event listeners first, and see what's happening, then try the AVPlay API, which I would recommend implementing in your apps.

<body>
 <video id='video' width='700' height='400'
   poster='yourPosterURI' src='yourVideoURI'
   controls style='background:black'>
 </video>
</body>    


var videoElement = document.getElementById('video');

videoElement.addEventListener('loadeddata', function() {
   console.log('Video loaded.');
});

videoElement.addEventListener('timeupdate', function() {
   console.log('Current time: ' + videoElement.currentTime);
});

videoElement.addEventListener('seeked', function() {
    console.log('Seek operation completed.');
    videoElement.play();
});

videoElement.addEventListener('stalled', function() {
    console.log('Video stalled.');
});

videoElement.addEventListener('ended', function() {
    console.log('Video ended.');
});
burakk
  • 1,231
  • 2
  • 22
  • 45