Skip to content

Commit

Permalink
Updates from video-js-swf
Browse files Browse the repository at this point in the history
  • Loading branch information
mslanza committed Jun 25, 2015
1 parent 9543437 commit a8c3046
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 34 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ _(none)_

--------------------

## 4.7.1 (2015-06-23)
* Fixed an issue where playback required two clisk to start when preload was not auto
* @qpSHiNqp fix issue that would cause incorrect aspect ratios for some videos ([view](https://github.com/videojs/video-js-swf/pull/165))

## 4.7.0 (2015-05-19)
* @bc-bbay the preload attribute should be a string, not a boolean ([view](https://github.com/videojs/video-js-swf/pull/160))
* @Wellming fix manual tests ([view](https://github.com/videojs/video-js-swf/pull/154))

## 4.6.1 (2015-04-22)
* @bclwhitaker append END_SEQUENCE properly in data generation mode ([view](https://github.com/videojs/video-js-swf/pull/152))

Expand Down
Binary file modified dist/video-js.swf
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "videojs-swf",
"description": "The Flash-fallback video player for video.js (http://videojs.com)",
"version": "4.6.1",
"version": "4.7.1",
"copyright": "Copyright 2014 Brightcove, Inc. https://github.com/videojs/video-js-swf/blob/master/LICENSE",
"keywords": [
"flash",
Expand Down
11 changes: 8 additions & 3 deletions src/VideoJS.as
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ package{
if(loaderInfo.parameters.autoplay != undefined && loaderInfo.parameters.autoplay == "true"){
_app.model.autoplay = true;
}
if(loaderInfo.parameters.preload === "none"){
_app.model.preload = false;

if(loaderInfo.parameters.preload != undefined && loaderInfo.parameters.preload != ""){
_app.model.preload = String(loaderInfo.parameters.preload);
}

if(loaderInfo.parameters.poster != undefined && loaderInfo.parameters.poster != ""){
Expand Down Expand Up @@ -332,8 +333,12 @@ package{
break;
case "autoplay":
_app.model.autoplay = _app.model.humanToBoolean(pValue);
if (_app.model.autoplay) {
_app.model.preload = "auto";
}
break;
case "preload":
_app.model.preload = _app.model.humanToBoolean(pValue);
_app.model.preload = String(pValue);
break;
case "poster":
_app.model.poster = String(pValue);
Expand Down
10 changes: 5 additions & 5 deletions src/com/videojs/VideoJSModel.as
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ package com.videojs{
private var _backgroundAlpha:Number = 0;
private var _volume:Number = 1;
private var _autoplay:Boolean = false;
private var _preload:Boolean = true;
private var _preload:String = "auto";
private var _loop:Boolean = false;
private var _src:String = "";
private var _rtmpConnectionURL:String = "";
Expand Down Expand Up @@ -219,7 +219,7 @@ package com.videojs{
if(_autoplay){
_provider.play();
}
else if(_preload){
else if(_preload == "auto"){
_provider.load();
}
}
Expand Down Expand Up @@ -276,7 +276,7 @@ package com.videojs{
if(_autoplay){
_provider.play();
}
else if(_preload){
else if(_preload == "auto"){
_provider.load();
}
}
Expand Down Expand Up @@ -352,10 +352,10 @@ package com.videojs{

}

public function get preload():Boolean{
public function get preload():String{
return _preload;
}
public function set preload(pValue:Boolean):void {
public function set preload(pValue:String):void {
_preload = pValue;
}

Expand Down
43 changes: 22 additions & 21 deletions src/com/videojs/providers/HTTPVideoProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ package com.videojs.providers{
private var _loadStarted:Boolean = false;
private var _loadCompleted:Boolean = false;
private var _loadErrored:Boolean = false;
private var _pauseOnStart:Boolean = false;
private var _pausePending:Boolean = false;
private var _onmetadadataFired:Boolean = false;

Expand Down Expand Up @@ -277,27 +276,28 @@ package com.videojs.providers{
_loadErrored = false;
_loadStarted = false;
_loadCompleted = false;
if (_model.preload) {
if (_model.preload == "auto") {
initNetConnection();
}
}

public function load():void{
_pauseOnStart = true;
_playbackStarted = false;
initNetConnection();
public function load():void {
if(!_loadStarted){
_playbackStarted = false;
initNetConnection();
}
}

public function play():void{
// if this is a fresh playback request
if(!_loadStarted){
_pauseOnStart = false;
_playbackStarted = false;
_metadata = {};
initNetConnection();
}
// if the asset is already loading
else{
_model.addEventListener(VideoPlaybackEvent.ON_STREAM_READY, function():void{
play();
});
load();
} else {
// if the asset is already loading
if (_hasEnded) {
_hasEnded = false;
_ns.seek(0);
Expand Down Expand Up @@ -397,6 +397,8 @@ package com.videojs.providers{
public function die():void{
if(_videoReference)
{
// Clears the image currently displayed in the Video object.
_videoReference.clear();
_videoReference.attachNetStream(null);
}

Expand Down Expand Up @@ -487,7 +489,6 @@ package com.videojs.providers{
if (_src.path === null) {
_pausePending = true;
}

_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_STREAM_READY, {ns:_ns}));
}

Expand Down Expand Up @@ -551,7 +552,7 @@ package com.videojs.providers{
_throughputTimer.reset();
_throughputTimer.start();

if(!_pauseOnStart || _model.autoplay){
if(_model.autoplay){
_model.broadcastEventExternally(ExternalEventName.ON_RESUME);
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_STREAM_START, {info:e.info}));
}
Expand Down Expand Up @@ -651,10 +652,6 @@ package com.videojs.providers{
}

public function onMetaData(pMetaData:Object):void{
if (_onmetadadataFired) {
return;
}

_metadata = pMetaData;
if(pMetaData.duration != undefined){
_isLive = false;
Expand All @@ -666,10 +663,14 @@ package com.videojs.providers{
_canSeekAhead = false;
}
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_META_DATA, {metadata:_metadata}));
_model.broadcastEventExternally(ExternalEventName.ON_METADATA, _metadata);
_model.broadcastEventExternally(ExternalEventName.ON_CAN_PLAY);

_model.broadcastEventExternally(ExternalEventName.ON_BUFFER_FULL);
// the first time metadata is encountered, trigger loadedmetadata, canplay, and loadeddata
if (!_onmetadadataFired) {
_model.broadcastEventExternally(ExternalEventName.ON_METADATA, _metadata);
_model.broadcastEventExternally(ExternalEventName.ON_CAN_PLAY);
_model.broadcastEventExternally(ExternalEventName.ON_BUFFER_FULL);
}

_onmetadadataFired = true;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
errorEventProxyFunction: "onSWFErrorEvent",
src: "",
autoplay: false,
preload: false,
preload: 'none',
};

var params = {
Expand Down
2 changes: 1 addition & 1 deletion tests/manual/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
// errorEventProxyFunction: "onSWFErrorEvent",
src: "",
autoplay: false,
preload: false,
preload: 'none',
};

var params = {
Expand Down
2 changes: 1 addition & 1 deletion tests/manual/manual_full.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
// errorEventProxyFunction: "onSWFErrorEvent",
src: "",
autoplay: false,
preload: false,
preload: 'none',
poster: "img/testPattern_ussr_480x360.png"
};

Expand Down
2 changes: 1 addition & 1 deletion tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function createSWF(e){
errorEventProxyFunction: "onSWFErrorEvent",
src: "http://video-js.zencoder.com/oceans-clip.mp4",
autoplay: false,
preload: true,
preload: 'auto',
poster: "http://video-js.zencoder.com/oceans-clip.png"
};

Expand Down

0 comments on commit a8c3046

Please sign in to comment.