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: 
dynamitemedia
Binge Watcher

HLS streaming questions

I have been playing with this a bit and got it somewhat working.

one issue i am having is getting more than 3 .ts files to play.

is there something i should be doing server side to make it work?

i have not added the
#EXT-X-ENDLIST


so not sure why its not going on to #4, #5, #6

anyone else had this issue?
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
50 REPLIES 50
RokuMarkn
Visitor

Re: HLS streaming questions

Are you using a third party HLS server or are you writing your own? If you're writing your own, you must update the m3u8 file to contain the URLs of the transport streams as they become available. I assume you start with three ts files and then add more over time? You should also make sure you aren't sending any cache control HTTP headers that might prevent a proxy from re-reading the updated m3u8 file.

--Mark
0 Kudos
dynamitemedia
Binge Watcher

Re: HLS streaming questions

thanks mark

i was doing it on my own server actually...

what sort of calls does it make to my sever? and how often? if i set the duration at 10 is it every 10 seconds?

I have been googling for two days about this and not much info about what it does serverside.


EDIT: did some tests and seems it does check back every 10 seconds if duration is set at 10 seconds...

on to more tests
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
RokuMarkn
Visitor

Re: HLS streaming questions

Section 6.3.4 of the HLS spec (http://tools.ietf.org/html/draft-pantos ... reaming-03) describes how the client should reload the m3u8. It normally reloads every "target duration" seconds but if it finds that the m3u8 has not changed, it switches to a different interval as described by the spec.

--Mark
0 Kudos
dynamitemedia
Binge Watcher

Re: HLS streaming questions

Mark i have read this over and over and thats how i got what little i did done, done...

I have made a "dirty" php script, which was somewhat working on my iphone but something is wrong and not sure the header refresh is best idea. or the timings are off or something

anyone else have any ideas? it works when just adding this "stream.php"

the header refresh was just an idea to not have to use reading writing to mysql or even a txt file.... i couldnt think of any other things but those 3 to get the next numbered file.


<?php
header("Content-Type: application/x-mpegURL");
header('Cache-Control: no-cache');
header('Pragma: no-cache');

$directory = "../streaming/";
$filecount = count(glob("" . $directory . "*.ts"));
$count =$_REQUEST["count"];

$title ="trailer";

if ( $count == $filecount ) {

$urlOne = 1;
$urlTwo = 2;
$urlThree = 3;

$titleOne ="$title$urlOne.ts";
$titleTwo ="$title$urlTwo.ts";
$titleThree ="$title$urlThree.ts";
?>

#EXTM3U
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:30
#EXTINF:10,
http://iptvmyway.com/roku/XXX/<?php echo $titleOne; ?><?php echo " \r\n"?>
#EXTINF:10,
http://iptvmyway.com/roku/XXX/<?php echo $titleTwo; ?><?php echo " \r\n"?>
#EXTINF:10,
http://iptvmyway.com/roku/XXX<?php echo $titleThree; ?><?php echo " \r\n"?>

<?php


$page = $_SERVER['PHP_SELF'];
$url ="$page?count=$urlThree";
$sec = "28";

header("Refresh: $sec; url=$url");


} else {

$urlOne = $count + 1;
$urlTwo = $urlOne + 1;
$urlThree = $urlTwo + 1;

$titleOne ="$title$urlOne.ts";
$titleTwo ="$title$urlTwo.ts";
$titleThree ="$title$urlThree.ts";

?>
#EXTM3U
#EXT-X-MEDIA-SEQUENCE:<?php echo $count + 1; ?><?php echo " \r\n"?>
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:30
#EXTINF:10,
http://iptvmyway.com/roku/XXX/<?php echo $titleOne; ?><?php echo " \r\n"?>
#EXTINF:10,
http://iptvmyway.com/roku/XXX/<?php echo $titleTwo; ?><?php echo " \r\n"?>
#EXTINF:10,
http://iptvmyway.com/roku/XXX/<?php echo $titleThree; ?><?php echo " \r\n"?>
<?php

$page = $_SERVER['PHP_SELF'];
$url ="$page?count=$urlThree";
$sec = "28";

header("Refresh: $sec; url=$url");

}
?>


Call me Crazy but i love trying to work in PHP! LOL
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
RokuMarkn
Visitor

Re: HLS streaming questions

I'm not much of a php expert, but what is $_REQUEST["count"] supposed to be? The client does not pass a "count" parameter to the m3u8 URL, if that's what you're expecting. It looks like you're trying to simulate a live stream? So you should be adding new TS files based on time, not on anything that comes from the client.

--Mark
0 Kudos
dynamitemedia
Binge Watcher

Re: HLS streaming questions

ahh sorry yes what is did was in the playlist
<html>
<head>
<title>iPhone Streams</title>
</head>
<body style="background-color:#FFFFFF; ">
<center>
<video controls width='250' height='250'>
<source src="playlists/stream.php?count=0"/>
</video>
</center>
</body>
</html>


is there a better way than what did in the code ? you mentioned time, i tried that too but my fear was

1.) more code working meant it could pause the stream
2.) maybe save some bandwith later on with a smaller file with less code
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
dynamitemedia
Binge Watcher

Re: HLS streaming questions

Mark...

I have been messing with this a bit today so and its working on VLC and stopped working on my iPhone and weird this is not even the stanadard .m3u8 is working on my iPhone anymore, its confusing.

But here is the finished code i made for a file, but even though the headers in the php file make it work as a .m3u8 Roku
wont recognize it it seems. i just did a test using the custom video example and add the .php file address. and it gives me this error. does it not like the .php extension here?

-
----- Running ------
11, 0: startup progress
11, 66: startup progress
11, 132: startup progress
9,-5: The format is not supported or the media is corrupt.
16, 0: Playback completed.
11, 0: end of playlist


here is the final code...
<?php      
header("Content-Type: application/x-mpegURL");
header("Cache-Control: no-cache");
header("Pragma: no-cache");

$directory = "../streaming/";
$filecount = count(glob("" . $directory . "*.ts"));

$duration= $filecount * 10;

?>
#EXTM3U<?php echo "\r\n"?>
#EXT-X-MEDIA-SEQUENCE:1<?php echo "\r\n"?>
#EXT-X-TARGETDURATION:<?php echo $duration;?><?php echo "\r\n"?>
#EXT-X-ALLOW-CACHE:NO<?php echo "\r\n"?>
<?php
$i=1;

while($i<=$filecount) {
$sequence = $i;

$vid= "videoTest";
$video = "$vid$sequence.ts";

?>
#EXTINF:10,<?php echo " \r\n"?>
http://iptvmyway.com/roku/HLS/streaming/<?php echo $video;?><?php echo "\r\n"?>
<?php
$i++;


} // closes while loop
?>
#EXT-X-ENDLIST
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
RokuMarkn
Visitor

Re: HLS streaming questions

One of the best ways to do a quick sanity check is download the m3u8 file in a browser or using a tool like curl or wget. You can then check the contents of the m3u8 you generated and see if it looks valid.

--Mark
0 Kudos
dynamitemedia
Binge Watcher

Re: HLS streaming questions

it does turn valid thats what i do every time, i even echo it out to the browser by slashing out the header info ...

look identical to one I hard code, no on have any luck or tried any of this yet? or is everyone still in contest hush mode? LOL
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos