Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
simranjit
Level 9

Looping a single Video

I want to loop a single video (mp4 or m3u8) using Roku Video node, once video finishes it automatically start playing from the starting which result into infinite playing of video in a loop. But once I am calling play method after on finishes of video it is showing a black screen in between the transition.


Video finish -> Black Screen -> Video Play


Please let me know, how I can handle this situation to get seamless looping of a particular video.


Thanks in advance. 

0 Kudos
3 Replies
necrotek
Level 11

Re: Looping a single Video

If you are looking for a seamless loop with video or audio, I don't think that is possible. Audio used to seamlessly loop but no longer does at least on the devices newer than Roku 3. Maybe you can look into prebuffering before the video finishes but I think only one video stream can be handled by a video node.  Roku seems to favor buffering over quick start.

0 Kudos
renojim
Level 21

Re: Looping a single Video

You could probably do it with an m3u8 playlist by just repeating the same segment(s) over and over again (maybe with #EXT-X-DISCONTINUITY tags in there when it repeats).  It's a bit of a hack.  You could make it a little cleaner by having your server simulate a live stream using the same idea.

I just tried it with a 2 second segment and it seemed to work:

#EXTM3U
#EXT-X-VERSION:2
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:2,
seg0001.ts
#EXT-X-DISCONTINUITY
#EXTINF:2,
seg0001.ts
#EXT-X-DISCONTINUITY
#EXTINF:2,
seg0001.ts
#EXT-X-DISCONTINUITY
#EXTINF:2,
seg0001.ts
#EXT-X-DISCONTINUITY
#EXTINF:2,
seg0001.ts
#EXT-X-DISCONTINUITY
#EXTINF:2,
seg0001.ts
#EXT-X-ENDLIST
0 Kudos
norcaljohnny
Level 10

Re: Looping a single Video

Instead of using a finish event try using something like

if (m.video.position = m.video.duration)

  m.video.position = 0

end if

I believe the problem is waiting for the on finish state to fire that causes the hiccup.

0 Kudos