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

Preload and ns play #122

Merged
merged 9 commits into from
Sep 29, 2014
Merged
Show file tree
Hide file tree
Changes from 3 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.
2 changes: 1 addition & 1 deletion src/VideoJS.as
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ package{
_app.model.autoplay = true;
}

if(loaderInfo.parameters.preload != undefined && loaderInfo.parameters.preload == "true"){
if(loaderInfo.parameters.preload != "none"){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may want this to be if(loaderInfo.parameters.preload && loaderInfo.parameters.preload != 'none')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If preload isn't present, we want it to be true. So, I think that check should be ok. But let me double check that we don't get an error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked it out and no error is thrown. If preload attribute isn't set on the video element, loaderInfo.parameters.preload is set to undefined, but no error is thrown and we preload the video.

_app.model.preload = true;
}

Expand Down
18 changes: 11 additions & 7 deletions src/com/videojs/providers/HTTPVideoProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ package com.videojs.providers{
private var _loadErrored:Boolean = false;
private var _pauseOnStart:Boolean = false;
private var _pausePending:Boolean = false;
private var _autoplay:Boolean = false;

/**
* The number of seconds between the logical start of the stream and the current zero
* playhead position of the NetStream. During normal, file-based playback this value should
Expand Down Expand Up @@ -250,8 +252,9 @@ package com.videojs.providers{
_loadErrored = false;
_loadStarted = false;
_loadCompleted = false;
if(pAutoplay){
initNetConnection();
_autoplay = pAutoplay;
if (_model.preload) {
this.load();
}
}

Expand Down Expand Up @@ -446,6 +449,7 @@ package com.videojs.providers{
_ns.client = this;
_ns.bufferTime = .5;
_ns.play(_src.path);
_ns.pause();
_videoReference.attachNetStream(_ns);

if (_src.path === null) {
Expand Down Expand Up @@ -505,11 +509,11 @@ package com.videojs.providers{
_loadStartTimestamp = getTimer();
_throughputTimer.reset();
_throughputTimer.start();
if(_pauseOnStart && _loadStarted == false){
_ns.pause();
_isPaused = true;
}
else{

if(!_pauseOnStart || _autoplay){
if(_autoplay){
_ns.resume();
}
_model.broadcastEventExternally(ExternalEventName.ON_RESUME);
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_STREAM_START, {info:e.info}));
}
Expand Down