Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

HLS Merge Changes #80

Merged
merged 13 commits into from
Feb 18, 2014
Merged
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
Binary file modified dist/video-js.swf
Binary file not shown.
6 changes: 3 additions & 3 deletions sandbox/videojs.html.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<title>Video.js | HTML5 Video Player</title>

<!-- Change URLs to wherever Video.js files will be hosted -->
<link href="node_modules/video.js/video-js.css" rel="stylesheet" type="text/css">
<link href="../node_modules/video.js/video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. -->
<script src="node_modules/video.js/video.js"></script>
<script src="../node_modules/video.js/video.js"></script>

<!-- Unless using the CDN hosted version, update the URL to the Flash SWF -->
<script>
videojs.options.flash.swf = "dist/video-js.swf";
videojs.options.flash.swf = "../dist/video-js.swf";
</script>

</head>
Expand Down
13 changes: 11 additions & 2 deletions src/VideoJS.as
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package{
import com.videojs.structs.ExternalEventName;
import com.videojs.structs.ExternalErrorEventName;
import com.videojs.Base64;

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
Expand Down Expand Up @@ -55,6 +55,7 @@ package{
_app.model.stageRect = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);

// add content-menu version info

var _ctxVersion:ContextMenuItem = new ContextMenuItem("VideoJS Flash Component v" + VERSION, false, false);
var _ctxAbout:ContextMenuItem = new ContextMenuItem("Copyright © 2014 Brightcove, Inc.", false, false);
var _ctxMenu:ContextMenu = new ContextMenu();
Expand All @@ -69,6 +70,7 @@ package{
try{
ExternalInterface.addCallback("vjs_appendBuffer", onAppendBufferCalled);
ExternalInterface.addCallback("vjs_echo", onEchoCalled);
ExternalInterface.addCallback("vjs_endOfStream", onEndOfStreamCalled);
ExternalInterface.addCallback("vjs_getProperty", onGetPropertyCalled);
ExternalInterface.addCallback("vjs_setProperty", onSetPropertyCalled);
ExternalInterface.addCallback("vjs_autoplay", onAutoplayCalled);
Expand Down Expand Up @@ -185,6 +187,10 @@ package{
private function onEchoCalled(pResponse:* = null):*{
return pResponse;
}

private function onEndOfStreamCalled():*{
_app.model.endOfStream();
}

private function onGetPropertyCalled(pPropertyName:String = ""):*{

Expand Down Expand Up @@ -274,8 +280,11 @@ package{
return null;
}

private function onSetPropertyCalled(pPropertyName:String = "", pValue:* = null):void{
private function onSetPropertyCalled(pPropertyName:String = "", pValue:* = null):void{
switch(pPropertyName){
case "duration":
_app.model.duration = Number(pValue);
break;
case "mode":
_app.model.mode = String(pValue);
break;
Expand Down
77 changes: 44 additions & 33 deletions src/com/videojs/VideoJSModel.as
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package com.videojs{
import com.videojs.structs.ExternalEventName;
import com.videojs.structs.PlaybackType;
import com.videojs.structs.PlayerMode;

import flash.events.Event;
import flash.events.EventDispatcher;
import flash.external.ExternalInterface;
Expand Down Expand Up @@ -43,9 +43,9 @@ package com.videojs{
private var _rtmpConnectionURL:String = "";
private var _rtmpStream:String = "";
private var _poster:String = "";

private static var _instance:VideoJSModel;

public function VideoJSModel(pLock:SingletonLock){
if (!pLock is SingletonLock) {
throw new Error("Invalid Singleton access. Use VideoJSModel.getInstance()!");
Expand All @@ -64,11 +64,12 @@ package com.videojs{
}
return _instance;
}

public function get mode():String{
return _mode;
}
public function set mode(pMode:String):void{

public function set mode(pMode:String):void {
switch(pMode){
case PlayerMode.VIDEO:
_mode = pMode;
Expand All @@ -84,32 +85,36 @@ package com.videojs{
public function get jsEventProxyName():String{
return _jsEventProxyName;
}
public function set jsEventProxyName(pName:String):void{
public function set jsEventProxyName(pName:String):void {
_jsEventProxyName = cleanEIString(pName);
}

public function get jsErrorEventProxyName():String{
return _jsErrorEventProxyName;
}
public function set jsErrorEventProxyName(pName:String):void{
public function set jsErrorEventProxyName(pName:String):void {
_jsErrorEventProxyName = cleanEIString(pName);
}

public function get stageRect():Rectangle{
return _stageRect;
}
public function set stageRect(pRect:Rectangle):void{
public function set stageRect(pRect:Rectangle):void {
_stageRect = pRect;
}

public function appendBuffer(bytes:ByteArray):void{
public function appendBuffer(bytes:ByteArray):void {
_provider.appendBuffer(bytes);
}

public function endOfStream():void {
_provider.endOfStream();
}

public function get backgroundColor():Number{
return _backgroundColor;
}
public function set backgroundColor(pColor:Number):void{
public function set backgroundColor(pColor:Number):void {
if(pColor < 0){
_backgroundColor = 0;
}
Expand All @@ -122,7 +127,7 @@ package com.videojs{
public function get backgroundAlpha():Number{
return _backgroundAlpha;
}
public function set backgroundAlpha(pAlpha:Number):void{
public function set backgroundAlpha(pAlpha:Number):void {
if(pAlpha < 0){
_backgroundAlpha = 0;
}
Expand All @@ -134,7 +139,7 @@ package com.videojs{
public function get videoReference():Video{
return _videoReference;
}
public function set videoReference(pVideo:Video):void{
public function set videoReference(pVideo:Video):void {
_videoReference = pVideo;
}

Expand All @@ -148,7 +153,7 @@ package com.videojs{
public function get volume():Number{
return _volume;
}
public function set volume(pVolume:Number):void{
public function set volume(pVolume:Number):void {
if(pVolume >= 0 && pVolume <= 1){
_volume = pVolume;
}
Expand All @@ -167,11 +172,17 @@ package com.videojs{
}
return 0;
}

public function set duration(value:Number):void {
if(_provider && _provider is HTTPVideoProvider) {
(_provider as HTTPVideoProvider).duration = value;
}
}

public function get autoplay():Boolean{
return _autoplay;
}
public function set autoplay(pValue:Boolean):void{
public function set autoplay(pValue:Boolean):void {
_autoplay = pValue;
}

Expand All @@ -181,7 +192,7 @@ package com.videojs{
}
return _src;
}
public function set src(pValue:String):void{
public function set src(pValue:String):void {
_src = pValue;
_rtmpConnectionURL = "";
_rtmpStream = "";
Expand All @@ -199,15 +210,15 @@ package com.videojs{
public function get rtmpConnectionURL():String{
return _rtmpConnectionURL;
}
public function set rtmpConnectionURL(pURL:String):void{
public function set rtmpConnectionURL(pURL:String):void {
_src = "";
_rtmpConnectionURL = pURL;
}

public function get rtmpStream():String{
return _rtmpStream;
}
public function set rtmpStream(pValue:String):void{
public function set rtmpStream(pValue:String):void {
_src = "";
_rtmpStream = pValue;
broadcastEventExternally(ExternalEventName.ON_SRC_CHANGE, _src);
Expand Down Expand Up @@ -235,7 +246,7 @@ package com.videojs{
* @param pValue
*
*/
public function set srcFromFlashvars(pValue:String):void{
public function set srcFromFlashvars(pValue:String):void {
_src = pValue;
_currentPlaybackType = PlaybackType.HTTP
initProvider();
Expand All @@ -251,7 +262,7 @@ package com.videojs{
public function get poster():String{
return _poster;
}
public function set poster(pValue:String):void{
public function set poster(pValue:String):void {
_poster = pValue;
broadcastEvent(new VideoJSEvent(VideoJSEvent.POSTER_SET));
}
Expand All @@ -278,7 +289,7 @@ package com.videojs{
public function get muted():Boolean{
return (_volume == 0);
}
public function set muted(pValue:Boolean):void{
public function set muted(pValue:Boolean):void {
if(pValue){
var __lastSetVolume:Number = _lastSetVolume;
volume = 0;
Expand Down Expand Up @@ -314,14 +325,14 @@ package com.videojs{
public function get preload():Boolean{
return _preload;
}
public function set preload(pValue:Boolean):void{
public function set preload(pValue:Boolean):void {
_preload = pValue;
}

public function get loop():Boolean{
return _loop;
}
public function set loop(pValue:Boolean):void{
public function set loop(pValue:Boolean):void {
_loop = pValue;
}

Expand Down Expand Up @@ -404,7 +415,7 @@ package com.videojs{
* @param e
*
*/
public function broadcastEvent(e:Event):void{
public function broadcastEvent(e:Event):void {
dispatchEvent(e);
}

Expand All @@ -413,7 +424,7 @@ package com.videojs{
* @param args
*
*/
public function broadcastEventExternally(... args):void{
public function broadcastEventExternally(... args):void {
if(_jsEventProxyName != ""){
if(ExternalInterface.available){
var __incomingArgs:* = args as Array;
Expand All @@ -428,7 +439,7 @@ package com.videojs{
* @param args
*
*/
public function broadcastErrorEventExternally(... args):void{
public function broadcastErrorEventExternally(... args):void {
if(_jsErrorEventProxyName != ""){
if(ExternalInterface.available){
var __incomingArgs:* = args as Array;
Expand All @@ -442,7 +453,7 @@ package com.videojs{
* Loads the video in a paused state.
*
*/
public function load():void{
public function load():void {
if(_provider){
_provider.load();
}
Expand All @@ -452,7 +463,7 @@ package com.videojs{
* Loads the video and begins playback immediately.
*
*/
public function play():void{
public function play():void {
if(_provider){
_provider.play();
}
Expand All @@ -462,7 +473,7 @@ package com.videojs{
* Pauses video playback.
*
*/
public function pause():void{
public function pause():void {
if(_provider){
_provider.pause();
}
Expand All @@ -472,7 +483,7 @@ package com.videojs{
* Resumes video playback.
*
*/
public function resume():void{
public function resume():void {
if(_provider){
_provider.resume();
}
Expand All @@ -483,7 +494,7 @@ package com.videojs{
* @param pValue
*
*/
public function seekBySeconds(pValue:Number):void{
public function seekBySeconds(pValue:Number):void {
if(_provider){
_provider.seekBySeconds(pValue);
}
Expand All @@ -494,7 +505,7 @@ package com.videojs{
* @param pValue A float from 0 to 1 that represents the desired seek percent.
*
*/
public function seekByPercent(pValue:Number):void{
public function seekByPercent(pValue:Number):void {
if(_provider){
_provider.seekByPercent(pValue);
}
Expand All @@ -504,7 +515,7 @@ package com.videojs{
* Stops video playback, clears the video element, and stops any loading proceeses.
*
*/
public function stop():void{
public function stop():void {
if(_provider){
_provider.stop();
}
Expand Down Expand Up @@ -539,7 +550,7 @@ package com.videojs{
return pString.replace(/[^A-Za-z0-9_.]/gi, "");
}

private function initProvider():void{
private function initProvider():void {
if(_provider){
_provider.die();
_provider = null;
Expand Down
6 changes: 5 additions & 1 deletion src/com/videojs/providers/HTTPAudioProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ package com.videojs.providers{
public function appendBuffer(bytes:ByteArray):void{
throw "HTTPAudioProvider does not support appendBuffer";
}

public function endOfStream():void{
throw "HTTPAudioProvider does not support endOfStream";
}

public function get buffered():Number{
if(duration > 0){
Expand Down Expand Up @@ -441,4 +445,4 @@ package com.videojs.providers{
_model.broadcastEventExternally(ExternalEventName.ON_METADATA, _metadata);
}
}
}
}
Loading