I need to create a HLS playlist which should contain PHP URLs instead of chunks name. In my opinion the .m3u8 playlist should looks like follow:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:4
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:11
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=0
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=1
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=2
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=3
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=4
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=5
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=6
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=7
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=8
#EXTINF:10,
http://localhost/hls/get.php?a=1&b=9
#EXT-X-ENDLIST
I have a few questions:
1. Is it possible to make it work?
2. How should I organize file sending in get.php? If, for example, I'll read a local file and then send it to requester.
Any help and information will be useful.
The specification for HLS is to serve media segments with a ".ts" extension. All HLS Players that are out there (Apple and 3rd party players) support this so this is the way to go to ensure success.
This is noted on the Apple dev page "Deploying HTTP Live Streaming - Configuring a Web Server"
(see https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/HTTPStreamingArchitecture/HTTPStreamingArchitecture.html#//apple_ref/doc/uid/TP40008332-CH101-SW13 ):
The distribution system is a web server or a web caching system that delivers the media files and index files to the client over HTTP. No custom server modules are required to deliver the content, and typically very little configuration is needed on the web server.
Recommended configuration is typically limited to specifying MIME-type associations for .M3U8 files and .ts files
and specifically in "HTTP Streaming Architecture" (see https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/HTTPStreamingArchitecture/HTTPStreamingArchitecture.html#//apple_ref/doc/uid/TP40008332-CH101-SW13 ) it is noted that file extension ".ts" gets a MIME Type "video/MP2T"
But to answer your question you would at least need to have your ".php" files served from your web server with a MIME type like a ".ts" file (so "video/MP2T") otherwise I'm sure Players will fail. Then you should use the Apple Media Stream Validator to examine your m3u8 files and your PHP media segment files to test to determine whether they will work with HLS clients (get it from developer.apple.com). If the Apple Media Stream Validator says your streams are OK then you may be in luck with your out-of-the-norm approach.
So what's preventing you from you using ".ts" files?