Skip to content

Commit

Permalink
dash updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjohnson916 committed Jul 17, 2014
1 parent 24da908 commit 961decd
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 16 deletions.
43 changes: 32 additions & 11 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,57 @@
height="540"
width="960"
controls>
<source
src="http://absassets.ign.com/z/assets.ign.com/videos/zencoder/,416/bbc9e960b4ccce9f7314f4f6c828cce8-110000,640/bbc9e960b4ccce9f7314f4f6c828cce8-1000000,960/bbc9e960b4ccce9f7314f4f6c828cce8-1500000,1280/bbc9e960b4ccce9f7314f4f6c828cce8-3000000,1920/bbc9e960b4ccce9f7314f4f6c828cce8-5000000,-1402129217-w.mp4.csmil/manifest.f4m?hdcore&b=200-"
type="application/adobe-f4m">
<source src="http://absassets.ign.com/z/assets.ign.com/videos/zencoder/,416/bbc9e960b4ccce9f7314f4f6c828cce8-110000,640/bbc9e960b4ccce9f7314f4f6c828cce8-1000000,960/bbc9e960b4ccce9f7314f4f6c828cce8-1500000,1280/bbc9e960b4ccce9f7314f4f6c828cce8-3000000,1920/bbc9e960b4ccce9f7314f4f6c828cce8-5000000,-1402129217-w.mp4.csmil/manifest.f4m?hdcore&b=200-" type="application/adobe-f4m">
</video>
<h1>HDS/DASH Source Switch</h1>
<select id="url-select">
<option selected value="http://absassets.ign.com/z/assets.ign.com/videos/zencoder/,416/bbc9e960b4ccce9f7314f4f6c828cce8-110000,640/bbc9e960b4ccce9f7314f4f6c828cce8-1000000,960/bbc9e960b4ccce9f7314f4f6c828cce8-1500000,1280/bbc9e960b4ccce9f7314f4f6c828cce8-3000000,1920/bbc9e960b4ccce9f7314f4f6c828cce8-5000000,-1402129217-w.mp4.csmil/manifest.f4m?hdcore&b=200-">Akamai HD2 HDS Example [http://assets.ign.com/bbc9e960b4ccce9f7314f4f6c828cce8-5000000,-1402129217-w.mp4.csmil/manifest.f4m]</option>
<option value="http://dashas.castlabs.com/videos/bytes/bbb/Manifest.mpd">DASH.as Example [http://dashas.castlabs.com/videos/bytes/bbb/Manifest.mpd]</option>
<option selected data-mime="application/adobe-f4m" data-url="http://absassets.ign.com/z/assets.ign.com/videos/zencoder/,416/bbc9e960b4ccce9f7314f4f6c828cce8-110000,640/bbc9e960b4ccce9f7314f4f6c828cce8-1000000,960/bbc9e960b4ccce9f7314f4f6c828cce8-1500000,1280/bbc9e960b4ccce9f7314f4f6c828cce8-3000000,1920/bbc9e960b4ccce9f7314f4f6c828cce8-5000000,-1402129217-w.mp4.csmil/manifest.f4m?hdcore&b=200-">Akamai HD2 HDS Example</option>
<option data-mime="application/dash+xml" data-url="http://dashas.castlabs.com/videos/bytes/bbb/Manifest.mpd">DASH.as Example</option>
</select>
<button>load</button>
<script>
// http://dashdemo.edgesuite.net/envivio/dashpr/clear/Manifest.mpd
// http://dashas.castlabs.com/videos/bytes/bbb/Manifest.mpd

// Akamai SRC
// DRM - http://bcqaus-vh.akamaihd.net/z/1910141515001/201406/1910141515001_3638100632001_TC-build-297-95e1558c-4de4-4b1f-b2c1-a7a564da038eMPEG-4-AVC-AAC0040005021270-32187b1e8f64c3cf.mp4.f4m/manifest.f4m
//http://multiplatform-f.akamaihd.net/z/multi/companion/bourne_ultimatum/The Bourne Ultimatum - Trailer_,1000,1500,2500,4000,k.mp4.csmil/manifest.f4m?hdcore
//IGN SRC
//http://absassets.ign.com/z/assets.ign.com/videos/zencoder/,416/bbc9e960b4ccce9f7314f4f6c828cce8-110000,640/bbc9e960b4ccce9f7314f4f6c828cce8-1000000,960/bbc9e960b4ccce9f7314f4f6c828cce8-1500000,1280/bbc9e960b4ccce9f7314f4f6c828cce8-3000000,1920/bbc9e960b4ccce9f7314f4f6c828cce8-5000000,-1402129217-w.mp4.csmil/manifest.f4m?hdcore&b=200-
// http://multiplatform-f.akamaihd.net/z/multi/companion/bourne_ultimatum/The Bourne Ultimatum - Trailer_,1000,1500,2500,4000,k.mp4.csmil/manifest.f4m?hdcore
// IGN SRC
// http://absassets.ign.com/z/assets.ign.com/videos/zencoder/,416/bbc9e960b4ccce9f7314f4f6c828cce8-110000,640/bbc9e960b4ccce9f7314f4f6c828cce8-1000000,960/bbc9e960b4ccce9f7314f4f6c828cce8-1500000,1280/bbc9e960b4ccce9f7314f4f6c828cce8-3000000,1920/bbc9e960b4ccce9f7314f4f6c828cce8-5000000,-1402129217-w.mp4.csmil/manifest.f4m?hdcore&b=200-
// Set Regular VideoJS SWF
videojs.options.flash.swf = 'node_modules/video.js/dist/video-js/video-js.swf';
// Set OSMF SWF
videojs.options.osmf.swf = 'dist/videojs-osmf.swf';
// Initialize the player
var player = videojs('vid1');
var select = document.querySelector('select');
var button = document.querySelector('button');
var selected = {
type: select.selectedOptions[0].dataset.mime,
src: select.selectedOptions[0].dataset.url
};

select.addEventListener('change', function(e) {
console.log('i changed', e.target.value);
player.pause();
player.src(e.target.value);

for(var o in e.target.options) {
if(e.target.options[o].selected){
selected = {
type: e.target.options[o].dataset.mime,
src: e.target.options[o].dataset.url
};
console.log(selected);
}
}
});

button.addEventListener('click', function(e) {
player.one('loadeddata', function() {
console.log('--- start');
player.play();
})
});
console.log('set src', selected);
player.src(selected);
})
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"grunt-shell": "0.6.1",
"grunt-concurrent": "0.4.3",
"load-grunt-tasks": "~0.4.0",
"video.js": "~4.6.2"
"video.js": "~4.6.4"
}
}
6 changes: 4 additions & 2 deletions src/as/VideoJSOSMF.as
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public class VideoJSOSMF extends Sprite {
}

private function onMediaErrorEvent(event:MediaErrorEvent):void {
Console.log('onMediaErrorEvent', event.toString());
Console.log('onMediaErrorEvent', event.error.name, event.error.detail, event.error.errorID, event.error.message);
dispatchExternalErrorEvent(event.type, event.error);
}

Expand Down Expand Up @@ -421,7 +421,7 @@ public class VideoJSOSMF extends Sprite {
5. Create Container
6. Create Element
*/
dispose();
//dispose();
createResource(src);
createMediaFactory();
createLayoutMetadata();
Expand All @@ -431,6 +431,7 @@ public class VideoJSOSMF extends Sprite {
_mediaPlayer.media = _contentMediaElement;
}

/* Not sure if I want this here or in the tech
private function dispose():void {
if(_mediaPlayer && _mediaPlayer.media) {
_mediaPlayer.media = null;
Expand All @@ -441,6 +442,7 @@ public class VideoJSOSMF extends Sprite {
if(_layoutMetadata) _layoutMetadata = null;
if(_mediaContainer) _mediaContainer = null;
}
*/

private function onAbortCalled(src:String):void {

Expand Down
4 changes: 2 additions & 2 deletions src/as/com/castlabs/dash/DashPlugin.as
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public class DashPlugin extends Sprite {
public function DashPlugin() {
super();

if (this.root.loaderInfo.parameters.log == "true") {
//if (this.root.loaderInfo.parameters.log == "true") {
Console.getInstance().enable();
}
//}

_pluginInfo = new DashPluginInfo();
}
Expand Down

0 comments on commit 961decd

Please sign in to comment.