Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled playback of non-DASH content with DASH.as plugin loaded #43

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
bin-debug/

# Flash Builder
.settings
.flexProperties
.flexLibProperties
.actionScriptProperties
.project
bin

# Maven
target/
Expand All @@ -23,4 +26,3 @@ rsync.sh
rsync_vanilla.sh
libs/
Flash Player Debugger.app/

97 changes: 55 additions & 42 deletions src/main/actionscript/com/castlabs/dash/DashPlugin.as
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
/*
* Copyright (c) 2014 castLabs GmbH
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package com.castlabs.dash {
import flash.display.Sprite;

import org.osmf.elements.VideoElement;
import org.osmf.media.MediaElement;
import org.osmf.media.MediaResourceBase;
import org.osmf.media.PluginInfo;

public class DashPlugin extends Sprite {
private var _pluginInfo:PluginInfo;

public function DashPlugin() {
super();

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

_pluginInfo = new DashPluginInfo();
}

public function get pluginInfo():PluginInfo {
return _pluginInfo;
}

public static function canHandleResource(resource:MediaResourceBase):Boolean {
return true;
}

public static function mediaElementCreationFunction():MediaElement {
return new VideoElement(null, DashContext.getInstance().dashNetLoader);
}
}
}
/*
* Copyright (c) 2014 castLabs GmbH
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package com.castlabs.dash {
import flash.display.Sprite;

import org.osmf.elements.VideoElement;
import org.osmf.media.MediaElement;
import org.osmf.media.MediaResourceBase;
import org.osmf.media.PluginInfo;
import org.osmf.media.URLResource;

public class DashPlugin extends Sprite {
private var _pluginInfo:PluginInfo;

public function DashPlugin() {
super();

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

_pluginInfo = new DashPluginInfo();
}

public function get pluginInfo():PluginInfo {
return _pluginInfo;
}

public static function canHandleResource(resource:MediaResourceBase):Boolean {

var urlResource:URLResource = resource as URLResource;

if (!urlResource || !urlResource.url)
{
return false;
}

var url:String = urlResource.url;

return /\.mpd/i.test(url)
|| /\.dash/i.test(url)
;
}

public static function mediaElementCreationFunction():MediaElement {
return new VideoElement(null, DashContext.getInstance().dashNetLoader);
}
}
}