I am currently investigating the feasibility of moving video sources out of the webroot, to prevent direct file access, and using a script to fetch and return the appropriate DASH file and relevant sources. Currently working completely barebones as possible to see if this is a feasible option.
Currently no issues with using something simple like:-
<video src="/mydash.mpd"></video>
However, I want to change this to do something like:-
<video src="source.php?/mydash.mpd"></video>
In source.php, simply fetch the file:-
<?php
header('Content-Type: application/xml');
readfile("../dir_outside_webroot/" . $_GET['video']);
?>
I can navigate directly to https://www.domain.com/source.php?video=mydash.mpd in the browser and I get a nice healthy looking DASH manifest.
However, Shaka is blowing up:-
Unable to guess manifest type by file extension or by MIME type. php application/xml
load() failed: shaka.util.Error聽{severity: 2, category: 4, code: 4000, data: Array(1), handled: false,聽鈥 Shaka Error MANIFEST.UNABLE_TO_GUESS_MANIFEST_TYPE (https://www.domain.com/video.php?video=mydash.mpd) Error: Shaka Error MANIFEST.UNABLE_TO_GUESS_MANIFEST_TYPE (https://www.domain.com/source.php?video=mydash.mpd)
at new shaka.util.Error (https://www.domain.com/shaka-player/dist/shaka-player.compiled.debug.js:79:774)
at https://www.domain.com/shaka-player/dist/shaka-player.compiled.debug.js:461:116
I am loosely assuming this is because Shaka strictly expects a Content Type of application/xml or even text/xml and the php file is serving the content.
So my question is, is this a feasible option? What exact Content Type is Shaka expecting?
Further down the line I would expect source.php to have some user-authentication and access rights checks, but for now, I can't get the barebones working.
Thanks.
We expect the Content-Type to be application/dash+xml. Accepting application/xml is too generic and applies to other content like TTML (which is also XML content). You can see what MIME type and extensions are supported by using shaka.Player.probeSupport() or by visiting https://shaka-player-demo.appspot.com/support.html (note that media type support is based on the browser support too and not exhaustive).
You can provide an explicit mimeType if necessary, when loading something. So if you know all of your content is MPEG-DASH, you can load your content like:
myPlayer.load(myUrl, 0, 'application/dash+xml');
That should make Shaka Player skip the content type checks, at least.
You can provide an explicit
mimeTypeif necessary, when loading something. So if you know all of your content is MPEG-DASH, you can load your content like:myPlayer.load(myUrl, 0, 'application/dash+xml');That should make Shaka Player skip the content type checks, at least.
That would do it, but eventually figured out what was going on due to a misconfiguration of php. Within the source.php, I set ini_set('default_mimetype', 'application/dash+xml') and I no longer got a Content-Type: php application/dash+xml response, just application/dash+xml, which pointed me towards the php.ini and all is now working once some changes were made there. Incidentally, I think I'm probably over-complicating matters here, so will probably look at simply creating a new VHOST on the server and restricting access to localhost services. Will see how that pans out...
Cheers!