Skip to content

Commit c82cb8a

Browse files
committed
merge video-js-swf v4.7.1
2 parents 031ce7e + 504c517 commit c82cb8a

File tree

10 files changed

+48
-34
lines changed

10 files changed

+48
-34
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ _(none)_
66

77
--------------------
88

9+
## 4.7.1 (2015-06-23)
10+
* Fixed an issue where playback required two clisk to start when preload was not auto
11+
* @qpSHiNqp fix issue that would cause incorrect aspect ratios for some videos ([view](https://github.com/videojs/video-js-swf/pull/165))
12+
13+
## 4.7.0 (2015-05-19)
14+
* @bc-bbay the preload attribute should be a string, not a boolean ([view](https://github.com/videojs/video-js-swf/pull/160))
15+
* @Wellming fix manual tests ([view](https://github.com/videojs/video-js-swf/pull/154))
16+
917
## 4.6.1 (2015-04-22)
1018
* @bclwhitaker append END_SEQUENCE properly in data generation mode ([view](https://github.com/videojs/video-js-swf/pull/152))
1119

dist/video-js.swf.old

17 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "videojs-swf",
33
"description": "The Flash-fallback video player for video.js (http://videojs.com)",
4-
"version": "4.6.1",
4+
"version": "4.7.1",
55
"copyright": "Copyright 2014 Brightcove, Inc. https://github.com/videojs/video-js-swf/blob/master/LICENSE",
66
"keywords": [
77
"flash",

src/VideoJS.as

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ package{
126126
if(loaderInfo.parameters.autoplay != undefined && loaderInfo.parameters.autoplay == "true"){
127127
_app.model.autoplay = true;
128128
}
129-
if(loaderInfo.parameters.preload === "none"){
130-
_app.model.preload = false;
129+
130+
if(loaderInfo.parameters.preload != undefined && loaderInfo.parameters.preload != ""){
131+
_app.model.preload = String(loaderInfo.parameters.preload);
131132
}
132133

133134
if(loaderInfo.parameters.poster != undefined && loaderInfo.parameters.poster != ""){
@@ -332,8 +333,12 @@ package{
332333
break;
333334
case "autoplay":
334335
_app.model.autoplay = _app.model.humanToBoolean(pValue);
336+
if (_app.model.autoplay) {
337+
_app.model.preload = "auto";
338+
}
339+
break;
335340
case "preload":
336-
_app.model.preload = _app.model.humanToBoolean(pValue);
341+
_app.model.preload = String(pValue);
337342
break;
338343
case "poster":
339344
_app.model.poster = String(pValue);

src/com/videojs/VideoJSModel.as

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ package com.videojs{
3838
private var _backgroundAlpha:Number = 0;
3939
private var _volume:Number = 1;
4040
private var _autoplay:Boolean = false;
41-
private var _preload:Boolean = true;
41+
private var _preload:String = "auto";
4242
private var _loop:Boolean = false;
4343
private var _src:String = "";
4444
private var _rtmpConnectionURL:String = "";
@@ -219,7 +219,7 @@ package com.videojs{
219219
if(_autoplay){
220220
_provider.play();
221221
}
222-
else if(_preload){
222+
else if(_preload == "auto"){
223223
_provider.load();
224224
}
225225
}
@@ -276,7 +276,7 @@ package com.videojs{
276276
if(_autoplay){
277277
_provider.play();
278278
}
279-
else if(_preload){
279+
else if(_preload == "auto"){
280280
_provider.load();
281281
}
282282
}
@@ -352,10 +352,10 @@ package com.videojs{
352352

353353
}
354354

355-
public function get preload():Boolean{
355+
public function get preload():String{
356356
return _preload;
357357
}
358-
public function set preload(pValue:Boolean):void {
358+
public function set preload(pValue:String):void {
359359
_preload = pValue;
360360
}
361361

src/com/videojs/providers/HTTPVideoProvider.as

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ package com.videojs.providers{
4343
private var _loadStarted:Boolean = false;
4444
private var _loadCompleted:Boolean = false;
4545
private var _loadErrored:Boolean = false;
46-
private var _pauseOnStart:Boolean = false;
4746
private var _pausePending:Boolean = false;
4847
private var _onmetadadataFired:Boolean = false;
4948

@@ -277,27 +276,28 @@ package com.videojs.providers{
277276
_loadErrored = false;
278277
_loadStarted = false;
279278
_loadCompleted = false;
280-
if (_model.preload) {
279+
if (_model.preload == "auto") {
281280
initNetConnection();
282281
}
283282
}
284283

285-
public function load():void{
286-
_pauseOnStart = true;
287-
_playbackStarted = false;
288-
initNetConnection();
284+
public function load():void {
285+
if(!_loadStarted){
286+
_playbackStarted = false;
287+
initNetConnection();
288+
}
289289
}
290290

291291
public function play():void{
292292
// if this is a fresh playback request
293293
if(!_loadStarted){
294-
_pauseOnStart = false;
295-
_playbackStarted = false;
296294
_metadata = {};
297-
initNetConnection();
298-
}
299-
// if the asset is already loading
300-
else{
295+
_model.addEventListener(VideoPlaybackEvent.ON_STREAM_READY, function():void{
296+
play();
297+
});
298+
load();
299+
} else {
300+
// if the asset is already loading
301301
if (_hasEnded) {
302302
_hasEnded = false;
303303
_ns.seek(0);
@@ -397,6 +397,8 @@ package com.videojs.providers{
397397
public function die():void{
398398
if(_videoReference)
399399
{
400+
// Clears the image currently displayed in the Video object.
401+
_videoReference.clear();
400402
_videoReference.attachNetStream(null);
401403
}
402404

@@ -487,7 +489,6 @@ package com.videojs.providers{
487489
if (_src.path === null) {
488490
_pausePending = true;
489491
}
490-
491492
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_STREAM_READY, {ns:_ns}));
492493
}
493494

@@ -551,7 +552,7 @@ package com.videojs.providers{
551552
_throughputTimer.reset();
552553
_throughputTimer.start();
553554

554-
if(!_pauseOnStart || _model.autoplay){
555+
if(_model.autoplay){
555556
_model.broadcastEventExternally(ExternalEventName.ON_RESUME);
556557
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_STREAM_START, {info:e.info}));
557558
}
@@ -651,10 +652,6 @@ package com.videojs.providers{
651652
}
652653

653654
public function onMetaData(pMetaData:Object):void{
654-
if (_onmetadadataFired) {
655-
return;
656-
}
657-
658655
_metadata = pMetaData;
659656
if(pMetaData.duration != undefined){
660657
_isLive = false;
@@ -666,10 +663,14 @@ package com.videojs.providers{
666663
_canSeekAhead = false;
667664
}
668665
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_META_DATA, {metadata:_metadata}));
669-
_model.broadcastEventExternally(ExternalEventName.ON_METADATA, _metadata);
670-
_model.broadcastEventExternally(ExternalEventName.ON_CAN_PLAY);
671666

672-
_model.broadcastEventExternally(ExternalEventName.ON_BUFFER_FULL);
667+
// the first time metadata is encountered, trigger loadedmetadata, canplay, and loadeddata
668+
if (!_onmetadadataFired) {
669+
_model.broadcastEventExternally(ExternalEventName.ON_METADATA, _metadata);
670+
_model.broadcastEventExternally(ExternalEventName.ON_CAN_PLAY);
671+
_model.broadcastEventExternally(ExternalEventName.ON_BUFFER_FULL);
672+
}
673+
673674
_onmetadadataFired = true;
674675
}
675676

tests/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
errorEventProxyFunction: "onSWFErrorEvent",
123123
src: "",
124124
autoplay: false,
125-
preload: false,
125+
preload: 'none',
126126
};
127127

128128
var params = {

tests/manual/manual.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
// errorEventProxyFunction: "onSWFErrorEvent",
123123
src: "",
124124
autoplay: false,
125-
preload: false,
125+
preload: 'none',
126126
};
127127

128128
var params = {

tests/manual/manual_full.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
// errorEventProxyFunction: "onSWFErrorEvent",
121121
src: "",
122122
autoplay: false,
123-
preload: false,
123+
preload: 'none',
124124
poster: "img/testPattern_ussr_480x360.png"
125125
};
126126

tests/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function createSWF(e){
88
errorEventProxyFunction: "onSWFErrorEvent",
99
src: "http://video-js.zencoder.com/oceans-clip.mp4",
1010
autoplay: false,
11-
preload: true,
11+
preload: 'auto',
1212
poster: "http://video-js.zencoder.com/oceans-clip.png"
1313
};
1414

0 commit comments

Comments
 (0)