Jump to content
Search Community

VideoLoader vs. ContentDisplay - how to play(), stop() etc...

undefinedman test
Moderator Tag

Recommended Posts

Hello there,

 

I have an issue with gathering VideoLoader from ContentDisplay (if this way is correct)

 

Simply, I load some video via VideoLoader appended to LoaderMax and after onComplete event I get ContentDisplay target. In the other class I retrieve the ContentDisplay and even works and play on stage beautifully, but the thing is I don't know how to control this.. I mean VideoPlayer contains methods, like playVideo etc... How can I get it in other class via ContentDisplay, because I got Video via rawContent, but actually I don't know if shall I use it.. and how to use it...

 

Is there a way to get it?

 

Thanks in advance!

Link to comment
Share on other sites

You can control the video playback methods like playVideo() and pauseVideo() directly through the VideoLoader that handled loading the video.

 

myVideoLoader.playVideo()

 

If you have access to the ContentDisplay of a VideoLoader, the ContentDisplay object has a loader property that refers to the VideoLoader that loaded it.

 

someContentDisplayObject.loader.playVideo();

 

I'll admit I'm a little confused by the last part of your question.

 

The second best thing to reading the docs on VideoLoader and ContentDisplay is to read the activetuts tutorial on VideoLoader. It covers nearly everything.

 

http://active.tutsplus.com/tutorials/actionscript/smart-as3-video-loading-with-greensock-loadermax-free-active-premium/

 

Be sure to download the source files.

Link to comment
Share on other sites

someContentDisplayObject.loader.playVideo();

 

are you sure? Because loader returns LoaderItem which does not contain playVideo(). It contains pause(), resume() but this simply does not work with the video that I have loaded.

 

But I checked the sources that you gave me and instead of LoaderMax.getContent("myVideo") //returns ContentDisplay

 

i Have used LoaderMax.getLoader("myVideo") and that's return VideoLoader :)

 

Thanks for the help! The best library ever!

Link to comment
Share on other sites

That's correct - the "loader" of a ContentDisplay is technically data typed to a generic LoaderItem for polymorphic reasons - SWFLoaders, ImageLoaders, and VideoLoaders all use a common ContentDisplay class. So the loader could be any of those types, but since you know that in your case it's a VideoLoader, you can simply cast it to that data type to avoid compiler errors:

 

VideoLoader(someContentDisplayObject.loader).playVideo();

 

Or

 

var vl:VideoLoader = someContentDisplayObject.loader as VideoLoader;
vl.playVideo();

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...