A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: [RESOLVED] Playing videos using querystring

  1. #1
    Junior Member
    Join Date
    Sep 2005
    Posts
    16

    resolved [RESOLVED] Playing videos using querystring

    I am running into some issues. I have created a loading video that plays on top of the main FLV until it is done buffering and then disappears. This should be straight forward, however, it does not work for me. WHAT AM I MISSING??? Please see my code below; the commented out text is my code that does not work. If I uncomment any of it the SWF will no longer work. Please help:

    import fl.video.FLVPlayback;

    var videoSource:String;
    var myFlvplayback:FLVPlayback;

    var inited:Boolean = false;

    if (inited == false){
    inited = true;

    //myFLVPlayback.bufferTime = 15;
    //myFLVPlayback.playWhenEnoughDownloaded();
    myFlvplayback.skin = “flash/SkinOverPlaySeekMute.swf”;

    try {

    var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

    if(paramObj.videourl){

    videoSource = paramObj.videourl;
    playTheVideo();
    }

    } catch (error:Error) {

    }
    }

    function playTheVideo():void{

    myFlvplayback.source = videoSource;
    }

    //myFLVPlayback.addEventListener(VideoEvent.BUFFERIN G_STATE_ENTERED, Buffering);
    //
    // function Buffering(e:VideoEvent):void {
    // splashVideo.seek(1);
    // splashVideo.visible = true;
    // splashVideo.play();
    //}
    //
    //myFLVPlayback.addEventListener(VideoEvent.PLAYING_ STATE_ENTERED, PlayingVid);
    //
    //function PlayingVid(e:VideoEvent):void{
    // splashVideo.visible = false;
    //}
    //
    //
    //myFLVPlayback.addEventListener(VideoEvent.COMPLETE , EndOfVid);
    //
    //function EndOfVid(e:VideoEvent):void{
    // splashVideo.visible = false;
    //}

  2. #2
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    What errors are you getting?

  3. #3
    Junior Member
    Join Date
    Sep 2005
    Posts
    16
    1046: Type was not found or was not a compile-time constant: VideoEvent.

  4. #4
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Add this in your imports:

    import fl.video.VideoEvent;

  5. #5
    Junior Member
    Join Date
    Sep 2005
    Posts
    16
    Now I am getting this error:
    1120: Access of undefined property myFLVPlayback.

  6. #6
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    This line

    var myFlvplayback:FLVPlayback;

    should read this

    var myFlvplayback:FLVPlayback = new FLVPlayback();

    You created the variable and datatyped it but never created the object associated to it.

  7. #7
    Junior Member
    Join Date
    Sep 2005
    Posts
    16
    still getting this:
    1120: Access of undefined property myFLVPlayback.

    thanks for the help.

  8. #8
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    You are interchanging between uppercase and lower case

    This is how you defined it:

    myFlvplayback

    And then sometimes you call it like this:

    myFLVPlayback

    make sure you're using the same case everywhere. If that's not the problem, you'll have to tell me what line is throwing the error

  9. #9
    Junior Member
    Join Date
    Sep 2005
    Posts
    16
    Here is the most up-to-date code:
    import fl.video.VideoEvent;
    import fl.video.FLVPlayback;

    var videoSource:String;
    var myFlvplayback:FLVPlayback = new FLVPlayback();

    var inited:Boolean = false;
    splashVideo.visible = false;
    if (inited == false){
    inited = true;

    myFlvPlayback.bufferTime = 15;
    myFlvPlayback.playWhenEnoughDownloaded();
    myFlvplayback.skin = "flash/SkinOverPlaySeekMute.swf";

    try {

    var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

    if(paramObj.videourl){

    videoSource = paramObj.videourl;
    playTheVideo();
    }

    } catch (error:Error) {

    }
    }

    function playTheVideo():void{

    myFlvplayback.source = videoSource;
    }

    myFlvPlayback.addEventListener(VideoEvent.BUFFERIN G_STATE_ENTERED, Buffering);

    function Buffering(e:VideoEvent):void {
    splashVideo.seek(1);
    splashVideo.visible = true;
    splashVideo.play();
    }

    myFlvPlayback.addEventListener(VideoEvent.PLAYING_ STATE_ENTERED, PlayingVid);

    function PlayingVid(e:VideoEvent):void{
    splashVideo.visible = false;
    }


    myFlvPlayback.addEventListener(VideoEvent.COMPLETE , EndOfVid);

    function EndOfVid(e:VideoEvent):void{
    splashVideo.visible = false;
    }

    I took a screen shot here is a link: http://www.davidlewis.com/TestFlashf...eenShot041.png

  10. #10
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Buddy you didn't fix what I told you!

    Look, I bolded out your definition (myFlvplayback) and all the other bolded out ones you call with a capital 'P' (myFlvPlayback).

    Code:
    var videoSource:String;
    var myFlvplayback:FLVPlayback = new FLVPlayback();
    
    var inited:Boolean = false;
    splashVideo.visible = false;
    if (inited == false){	
    inited = true;
    
    myFlvPlayback.bufferTime = 15;
    myFlvPlayback.playWhenEnoughDownloaded();	
    myFlvplayback.skin = "flash/SkinOverPlaySeekMute.swf";
    
    try {
    
    var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
    
    if(paramObj.videourl){
    
    videoSource = paramObj.videourl;
    playTheVideo();
    }
    
    } catch (error:Error) {
    
    }
    }
    
    function playTheVideo():void{
    
    myFlvplayback.source = videoSource;
    }
    
    myFlvPlayback.addEventListener(VideoEvent.BUFFERIN G_STATE_ENTERED, Buffering);
    
    function Buffering(e:VideoEvent):void {
    splashVideo.seek(1);	
    splashVideo.visible = true;
    splashVideo.play();
    }
    
    myFlvPlayback.addEventListener(VideoEvent.PLAYING_ STATE_ENTERED, PlayingVid);
    
    function PlayingVid(e:VideoEvent):void{
    splashVideo.visible = false;
    }
    
    
    myFlvPlayback.addEventListener(VideoEvent.COMPLETE , EndOfVid);
    
    function EndOfVid(e:VideoEvent):void{
    splashVideo.visible = false;
    }

  11. #11
    Junior Member
    Join Date
    Sep 2005
    Posts
    16
    OK, i am an IDIOT!!!! I am not getting errors anymore, but now the video is not showing on the page. When I uncomment these items the video plays. I have included my source files here. The reason the rar is so large as I included the FLV that it is trying to play. thanks for all your help:
    http://www.davidlewis.com/TestFlashf...ideoPlayer.rar

  12. #12
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Oops. Nevermind.

  13. #13
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Can you trace paramObj.videourl before passing it to video source?

  14. #14
    Junior Member
    Join Date
    Sep 2005
    Posts
    16
    I am not exactly sure what this will do for me. If you notice the video audio plays. It is very strange.

  15. #15
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    I didn't download the file.

  16. #16
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Tracing the paramObj.videourl would tell you what that variable contains. In this case, what I was trying to accomplish is seeing if the FLVPlayback object was actually being passed something as a source.

    Did you take this code out of somewhere else? I notice you have extra white space in your event listeners.

    And what's splashvideo? Shouldn't splashvideo be myFlvplayback instead?

    I don't see myFlvplayback being added to the display list at any point.

  17. #17
    Junior Member
    Join Date
    Sep 2005
    Posts
    16
    Your last comment made me review the code and think about it. I figured it out. Everything was correct except that I had added some code to hide the splashvideo late last night because it kept popping up. I removed that one line of code and all is good! Thanks so much for your HELP!!!

  18. #18
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    You're welcome. Please mark the thread as resolved. (Top right, Thread Tools -> Mark Thread Resolved)

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