CodeCanyon

AS3 youtube api

5008 posts The Dude Abides
  • United States
  • Elite Author
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
+4 more
CodingJack says

I think they use a Timer for about a second to allow you to gain reference to the player. Maybe this is the problem? Not sure.

I would try the following:

Set the “onStateChange” listener to have a weak reference.

Then don’t remove the event listener in your kill function.

Then in your onStateChange function, add an if statement like this:

if(player == null) {

    Object(event.target).destroy();

}

Edit: Also, Is the loader still in the display list? Maybe you need to remove the loader form the stage?

531 posts
  • Bought between 10 and 49 items
  • Contributed a Blog Post
  • Elite Author
  • Exclusive Author
  • Germany
  • Has been a member for 3-4 years
  • Referred between 100 and 199 users
+1 more
radykal says

I solved it in a different way. I create a isReady variable, which will be set to true when the video starts playing or when the video is cued. Then I dispatch an own ready event and the corresponding listener with the handler toggles the mouseEnabled property for the skip buttons.

But one generic question…...when I use weak reference, I dont need to remove the event listeners???

1844 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says

if component has a destroy method, it should just terminate itself when told to.

but this is not always the case with the yt player coz is buggy.

such issues can only be fixed upstream.

5008 posts The Dude Abides
  • United States
  • Elite Author
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
+4 more
CodingJack says
But one generic question…...when I use weak reference, I dont need to remove the event listeners???

Technically no. If all other references have been destroyed and the only thing left is a weak referenced event listener, the object will be freed from memory.

But BF is right, the yt player is buggy and there’s not much that can be done :|

5008 posts The Dude Abides
  • United States
  • Elite Author
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
+4 more
CodingJack says

Been doing some profiling tonight. YouTube chromeless doesn’t clean up — period. I think this is the Google Flash office:

http://www.youtube.com/watch?v=3efW4AziWCg

FP10 and unloadAndStop seems like the only solution.

1844 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says
FP10 and unloadAndStop seems like the only solution.
have you tested it ? coz unloadAndStop seems to fail with complex items.

won’t work with mines if removing clean up code.

5008 posts The Dude Abides
  • United States
  • Elite Author
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
+4 more
CodingJack says

^ no I just assumed that would be the solution. What a bummer :( Maybe we should see if Google is hiring :D

5008 posts The Dude Abides
  • United States
  • Elite Author
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
+4 more
CodingJack says

Did lots of testing on the chromeless player this morning. unloadandStop() doesn’t do jack.

For the test, I created a swf and loaded a youtube-based swf into it. Here are the results (after running the Garbage Collector)

http://www.blazethefire.com/youtubefailure/

You’ll see at the bottom that the document class of the you-tube based swf doesn’t get freed from memory. I imagine this is equivalent to loading a module in a template and never having the module being freed from memory when you change the page.

Here’s the document class of the parent swf:

http://pastie.org/1210075

Here’s the document class for the youtube swf:

http://pastie.org/1210080

1072 posts
  • Sold between 250 000 and 1 000 000 dollars
  • Elite Author
  • Has been a member for 5-6 years
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Interviewed on the Envato Notes blog
  • Referred between 200 and 499 users
+4 more
damojo says

I guess I’ll just use this thread for a youtube related question.

Im still confused on the official word regarding youtube material like movie trailers being used in activeden files. If the trailer is from an official source on youtube like the channel of sony pictures (http://www.youtube.com/user/SonyPictures) its ok to use?

1844 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says
I guess I’ll just use this thread for a youtube related question. Im still confused on the official word regarding youtube material like movie trailers being used in activeden files. If the trailer is from an official source on youtube like the channel of sony pictures (http://www.youtube.com/user/SonyPictures) its ok to use?
you can only if absolutely sure you’re allowed by copyright holder.

which basicly means that if SonyPictures think you are not, you will be held responsable for copyright infringement.

by
by
by
by
by