dcsimg
A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 42

Thread: pull youtube movie into flash

  1. #21
    Junior Member
    Join Date
    Jun 2007
    Posts
    8
    Thanks!

  2. #22
    Senior Member Jaffasoft's Avatar
    Join Date
    Apr 2001
    Location
    On Travel
    Posts
    1,587
    YouTube is now giving an option in the 'My Account' to create the look of your player. Anyone know how to put this in flash? I created a player using what YouTube provides this is the code they gave!

    Code:
    <object width='780' height='445'><param name='movie' value='http://www.youtube.com/cp/vjVQa1PpcFPTZLgSo1M2p3t3fJCSxoVcesRmbmLhqzc='></param><param name='wmode' value='transparent'></params><embed src='http://www.youtube.com/cp/vjVQa1PpcFPTZLgSo1M2p3t3fJCSxoVcesRmbmLhqzc=' type='application/x-shockwave-flash' wmode='transparent' width='780' height='445'></embed></object>

  3. #23
    hey. hey. a-hey-na-ney-na-hey D-von's Avatar
    Join Date
    May 2002
    Posts
    304
    i dont know if its worth ressurecting this thread, as it seems theres no answers, but i've loaded youtube swfs fine into my flash site. for multiple ones, i just made separate movie clips and loaded and unloaded them into their own. the only problem i've been running into is that when i click on a different movie, the sound from the previous movie still plays. i've tried stop all sounds and blah blah... weird thing is that when i preview it on my computer, the sounds stop and it works as it should. uploaded to the internet, the sound is still wonky....

    ??

  4. #24
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  5. #25
    Senior Member Jaffasoft's Avatar
    Join Date
    Apr 2001
    Location
    On Travel
    Posts
    1,587
    Thanks for bringing the thread up again and for the update!

    I ended up making this simple site and just pulling in the videos into the custom player that YouTube Provides.

    I only just got around to making the official site it work well so far as when I add a video or anyone else in the group at youtube adds a video it is automatically updated in the site.

    I will leave it like that for now until I get time to customize something other specific things and clips etc. www.ForPropertyInvestors.com

    WebDreamer I like the rim that you have around that blog site I'm looking for something like that for this new site! Would you mind if I used it?

  6. #26
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    WebDreamer I like the rim that you have around that blog site I'm looking for something like that for this new site! Would you mind if I used it?
    It's default theme for wordpress.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  7. #27
    Junior Member
    Join Date
    Jul 2005
    Location
    Jamaica
    Posts
    17
    Hey mon youtube release there API for actionscript and javascript
    this include all scriting needed to load and customize youtube in your swf

  8. #28
    Junior Member
    Join Date
    Jul 2005
    Location
    Jamaica
    Posts
    17
    ytPlayerLoaderListener = {};
    var loadInterval:Number;
    ytPlayerLoaderListener.onLoadInit = function() {
    loadInterval = setInterval(checkPlayerLoaded, 250);
    }

    function checkPlayerLoaded():Void {
    if (ytplayer.isPlayerLoaded()) {
    ytplayer.addEventListener("onStateChange", onPlayerStateChange);
    ytplayer.addEventListener("onError", onPlayerError);
    loadIndicator._visible = false;
    clearInterval(loadInterval);
    }
    }

    function onPlayerStateChange(newState:Number) {
    trace("New player state: "+ newState);
    }

    function onPlayerError(errorCode:Number) {
    trace("An error occurred: "+ errorCode);
    }

    ytPlayerLoader = new MovieClipLoader();
    ytPlayerLoader.addListener(ytPlayerLoaderListener) ;


    ytPlayerLoader.loadClip("http://www.youtube.com/v/VIDEO_ID", ytplayer);

  9. #29
    Junior Member
    Join Date
    Apr 2008
    Posts
    7

    YouTube Video in flash

    Hi there,
    I manage to add the youtube video into a container in flash and I did manage to scale it. My problem is that I can't remove it. I'm developing a ticker, so it keeps on pilling up all these videos until it blows-up due to memmory. I've tryed everything from unloadMovie to delete. nothing seems to work. Does anyone knows how to solve this?

  10. #30
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    When loading multiple player SWFs, (including loading a new player SWF in place of a previous player) you will need to load the player into a MovieClip with a different name than previous players. For example, if you loaded a video into _root.youtubeplayer, when you want to load a new player, you would use something like _root.youtubeplayer2, and so on.

    When unloading a YouTube player, you should always call stopVideo() first. This will close the NetStream object and stop the video from continuing to download even after the player has been unloaded.
    http://code.google.com/apis/youtube/...reference.html

    this might be the problem.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  11. #31
    Junior Member
    Join Date
    Apr 2008
    Posts
    7
    Thank's. I was really strugling with it. Stoping the video makes the trick. Thank you!

  12. #32
    Junior Member
    Join Date
    Apr 2008
    Posts
    7

    stoping ytplayer

    webdreamer, you've helped me with this in the past but I have a new problem and I just can’t solve it. Maybe it is simple but I just don't see it.
    I'm developing a ticket movie. Xml feeds images and youtube videos. You can click on the video and the ticker stops until the video ends or you stop it. Then he restarts. All works well the first time around. The second time the video will not stop. I've looked at it and from what I understand, I'm not able to fully remove the player from the stage and them some kind of conflict occurs. I'm able to see this because the sandbox violation warning never disappears. Can you guess what am I doing wrong?

  13. #33
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Can you post your files so i can take a look?
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  14. #34
    Junior Member
    Join Date
    Apr 2008
    Posts
    7
    Sure. I don't know how to post them here so I've posted them on my testing website. You have the files here http://www.joaotrindade.com/guest/ticker.zip
    and the ticker online here http://www.joaotrindade.com/guest/ticker_3.html.
    I'm sorry is the code is a bit messy, I've been trying to solve it and...
    I have three pieces of code: one at the root, a timer and a vid_container (ytplayer).
    Thanks a lot!

  15. #35
    Junior Member
    Join Date
    Apr 2008
    Posts
    7
    I forgot to tell you something. The file works offline (flash preview) but then it doesn't work online.

    Thanks,
    Joao

  16. #36
    Junior Member
    Join Date
    Apr 2008
    Posts
    7
    I've just realized that the zip is not working (it was before, I'm sorry). I've posted it at http://www.arboretto.com/test/ticker_3.zip.
    Thanks for your help,
    Janica

  17. #37
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    You can click on the video and the ticker stops until the video ends or you stop it.
    Timer doesn't stop and the video doesn't play.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  18. #38
    Member
    Join Date
    Oct 2002
    Posts
    57
    Quick question about using the youtube API in Flash. All I really want to do is size my video properly.

    According to this: http://code.google.com/apis/youtube/...reference.html it says that "Once the player is loaded and ready, all API calls can be made in the same way as the JavaScript API". The javascript API commands are here: http://code.google.com/apis/youtube/...reference.html and it says to use setSize to change the dimensions of the video but how do I incorporate javascript commands in flash; it just doesn't seem to be working.

    Thanks.

  19. #39
    Junior Member
    Join Date
    Apr 2008
    Posts
    7
    Adding a different size to the video is not a problem because you will open it inside a container and you're free to give it any size you want. The problem I had was, if your're trying to load multiple videoa, slide show type, it doesn't work anymore

  20. #40
    Registered User
    Join Date
    Oct 2009
    Posts
    1

    Soluction i think

    System.security.allowDomain("http://www.youtube.com");
    System.security.loadPolicyFile("http://s.ytimg.com/yt/swf/cps-vfl123151.swf");

    // create a MovieClip to load the player into
    var ytplayer:MovieClip = _root.createEmptyMovieClip("ytplayer", 1);


    // create a listener object for the MovieClipLoader to use
    var ytPlayerLoaderListener:Object = {
    onLoadInit: function() {
    // When the player clip first loads, we start an interval to
    // check for when the player is ready
    loadInterval = setInterval(checkPlayerLoaded, 250);

    }
    };

    var loadInterval:Number;


    function checkPlayerLoaded():Void {
    // once the player is ready, we can subscribe to events, or in the case of
    // the chromeless player, we could load videos
    if (ytplayer.isPlayerLoaded()) {
    ytplayer.addEventListener("onStateChange", onPlayerStateChange);
    ytplayer.addEventListener("onError", onPlayerError);
    clearInterval(loadInterval);

    //resize video
    ytplayer._xscale = 45
    ytplayer._yscale = 45

    }
    }

    function onPlayerStateChange(newState:Number) {
    trace("New player state: "+ newState);
    }

    function onPlayerError(errorCode:Number) {
    trace("An error occurred: "+ errorCode);
    }


    // create a MovieClipLoader to handle the loading of the player
    var ytPlayerLoader:MovieClipLoader = new MovieClipLoader();
    ytPlayerLoader.addListener(ytPlayerLoaderListener) ;

    // load the player



    ytPlayerLoader.loadClip("http://www.youtube.com/v/Xb2koHfkRSY",ytplayer );

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center