Skip to content

Adding MediaPlayerFactory for simpler page embeds

Vinay Rosenberg requested to merge github/fork/wilaw/development into development

Created by: wilaw

Introducing a MediaPlayerFactory, which initializes MediaPlayers in a web page and automates the conversion of the videoElement to a functioning DASH player. The createDashPlayers method will search the DOM for all VideoElements of the class type 'dashjs-player' and then call the createDashPlayer method on each one. The createDashPlayer accepts a videoElement as input and then initializes a MediaPlayer around it, extracting the source URL from the source element.

Four new sample files are added to illustrate operation of the class: auto-load-single-video.html - shows the simplest possible embed of the player in to a page with a single videoElement. auto-load-multi-video.html - shows how 3 video players are added, two of which are dash.js players (one with autostart, one without) and a one which is a standard progressive mp4. auto-load-single-video-with-reference.html - shows how to use the MediaPlayer reference returned by the createDashPlayers method to listen to metrics and trace out the buffer length. manual-load-single-video.html - the older (and still fully supported) method for adding the player to the page by establishing a DashContext.

Merge request reports