Reputation: 91
I've been trying to setup mpeg dash streaming, but I'm not having much luck. I have the dash.all.debug.js added to the html, but then it asks for a /dash.all.debug.js.map which I found here. But after that, nothing. Clearly something is working because it asked for the map file, but after that neither Chrome nor Firefox do anything. They ask for the mpd, which I give and was verified on a random website, but there are no requests made to the server.
html code is:
<html>
<head>
<script src="dash.all.debug.js"></script>
<script>
(function(){
var url = "http://dash.edgesuite.net/envivio/Envivio-dash2/manifest.mpd";
var player = dashjs.MediaPlayer().create();
player.initialize(document.querySelector("#videoPlayer"), url, true);
})();
</script>
</head>
<body>
<img src="Soranin.jpg" alt="not found" height=500>
video:
<video id="videoPlayer" src="media/movies/Demo/video.mpd" type="application/dash+xml"></video>
</body>
</html>
The console log says
[10] [dash.js 2.6.8] MediaPlayer has been initialized
so something somewhere has to be working, right? What am I missing?
Upvotes: 0
Views: 3429
Reputation: 1251
There are a couple of problems here.
The main problem is that the querySelector in the script initialising the player returns null because the script runs before the DOM is ready. Move this script to the bottom of the body to solve this, or ensure the script runs when the DOM is ready rather than immediately.
The second is that isn't possible to set the source to DASH manifest and get video playback because most browsers (other than Edge) are not capable of native DASH playback. If it was, you wouldn't need dash.js. Remove the src
and type
attributes from your video tag, and set the url
variable in the initialising script above to your manifest url.
Follow https://github.com/Dash-Industry-Forum/dash.js/#standard-setup for full instructions. There's also a super-easy version where you don't need to write any code: https://github.com/Dash-Industry-Forum/dash.js/#quick-start-for-users.
Upvotes: 3