Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
simranjit
Binge Watcher

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 3
necrotek
Roku Guru

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
Community Streaming Expert

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
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
norcaljohnny
Roku Guru

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