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

Preload and ns play #122

merged 9 commits into from
Sep 29, 2014

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Sep 26, 2014

  • Make sure that the preload boolean gets set correctly based on the value specificed in html5 (unless preload=='none', set preload to true).
  • If we are preloading, we want to initialize the netconnection and netstream but not play. So, immediately after the ns is initialized and called play to add in the video url, we pause the ns.
  • We are are autoplaying, or play has been called, resume the ns.
  • Fire loadeddata after loadedmetadata in onmetadata
  • Only have onmetadata run once per video
  • Allow setting preload and autoplay programmatically.

Also, allow calling load without having the video play.
Autoplay should autoplay the video as well.
@@ -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.

@tomjohnson916
Copy link
Contributor

see comment above, otherwise LGTM.

Set preload to false if preload is set to 'none'
@@ -523,7 +528,9 @@ package com.videojs.providers{
break;

case "NetStream.Buffer.Full":
_model.broadcastEventExternally(ExternalEventName.ON_BUFFER_FULL);
if(!_loadeddataFired){
Copy link
Member Author

Choose a reason for hiding this comment

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

This is to make sure that ON_BUFFER_FULL fired if for some reason it didn't fire in onMetaData.

@gkatsev
Copy link
Member Author

gkatsev commented Sep 26, 2014

Addresses videojs/video.js#1523

@heff
Copy link
Member

heff commented Sep 26, 2014

Does the new ns pause cause any extra pause event?


Steve Heffernan (mobile)

On Sep 26, 2014, at 9:25 AM, Gary Katsevman [email protected] wrote:

Addresses videojs/video.js#1523


Reply to this email directly or view it on GitHub.

@gkatsev
Copy link
Member Author

gkatsev commented Sep 26, 2014

@heff good question. I'll double check.

@gkatsev
Copy link
Member Author

gkatsev commented Sep 26, 2014

@heff no, there is no extra pause event.

Don't bother firing ON_BUFFER_FULL in NetStream.Buffer.Full. Always fire
it in onmetadata.
Unless pauseOnStart is set, we always want to resume the netstream.
@gkatsev
Copy link
Member Author

gkatsev commented Sep 27, 2014

Addresses #82.

@@ -246,12 +248,13 @@ package com.videojs.providers{
}

public function init(pSrc:Object, pAutoplay:Boolean):void{
_onmetadadataFired = false;
Copy link
Member

Choose a reason for hiding this comment

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

on da meta da data da fired

@dmlap
Copy link
Member

dmlap commented Sep 28, 2014

Did some comparison of events emitted by the video element (or the flash tech) during playback. You can check out the raw data if you're interested. I will follow up with some observations in a bit.

@dmlap
Copy link
Member

dmlap commented Sep 28, 2014

Flash behavior on different platforms is relatively consistent. Comparing HTML playback with the SWF after this change, the notable discrepancies I see are:

  • progress consistently fired before loadstart
  • waiting not firing when preload is none
  • canplaythrough may fire before canplay
  • progress firing infrequently
  • loadstart occurs before play when autoplay is on
  • playing firing before loadedmetadata and loadeddata

@dmlap
Copy link
Member

dmlap commented Sep 29, 2014

Even though there are still some discrepancies between Flash and HTML, I think this patch is a significant improvement. I'm going to file an issue for the observations above and pull this in.

dmlap added a commit that referenced this pull request Sep 29, 2014
@dmlap dmlap merged commit f924c32 into master Sep 29, 2014
@dmlap dmlap deleted the preload-and-ns-play branch September 29, 2014 16:52
dmlap added a commit to dmlap/video-js-swf that referenced this pull request Jun 23, 2015
When we attempted to ensure that "loadeddata" would never fire before "loadedmetadata" in videojs#122, we also stopped updated video dimensions from propagating to the video view. Retain the boolean to ensure that load events only occur once per video but scope the conditional so that the other effects of new metadata are still run.
@dmlap dmlap mentioned this pull request Jun 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants