Results 1 to 8 of 8

Thread: Pause flash video using Javascript command

  1. #1
    Join Date
    May 2010
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Pause flash video using Javascript command

    Hello,

    Not sure if this is the right forum, but if you can help me it would be much appreciated...

    Here's the senario. I'm using DynamicDrive's "Content Glider" - http://www.dynamicdrive.com/dynamici...tentglider.htm
    to expand a hidden video...

    Everything works great until you click to hide to the video(colapse the div tag) it continues to play in the hidden state.

    Is there any way to automatically shut it off when its hidden?

    If you go to the link above it will show you the code in which how it works.

    Thanks,

    Brian

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Please post a link to the page on your site that contains the problematic script so we can check it out.


    I can't tell from your post even what format the video is in.

    Basically yes you can do this; you will add an extra event when you are hiding the layer; it will be the Javascript function to pause the video.

    The exact code will depend on the format of the video, and in some cases it may not be possible. If you explain more, we'll see about the specific format and what can be done.



    By the way, the link in your post doesn't work.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    jamesR (05-21-2010)

  4. #3
    Join Date
    May 2010
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    Please post a link to the page on your site that contains the problematic script so we can check it out.


    I can't tell from your post even what format the video is in.

    Basically yes you can do this; you will add an extra event when you are hiding the layer; it will be the Javascript function to pause the video.

    The exact code will depend on the format of the video, and in some cases it may not be possible. If you explain more, we'll see about the specific format and what can be done.



    By the way, the link in your post doesn't work.

    Thank you so much my friend!!!! You have no idea how this will help me, serioulsy...

    Here is my video container and flash embedded code. the the video itself is .mp4 or H.264.



    HTML Code:
     <div id="jackee" style="display:none">      
            <div style="padding-left:25px"><img src="Images/background/footerbtnBGtop.jpg" width="903" height="47" /></div>
    <div class="jackeehVid">
              <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="740" height="482" id="FlashID2" title="jackeeHarryVideo">
                <param name="movie" value="flash/video/jackeehvideo.swf" />
                <param name="quality" value="high" />
                <param name="wmode" value="opaque" />
                <param name="swfversion" value="6.0.65.0" />
                <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                <param name="expressinstall" value="Scripts/expressInstall.swf" />
                <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                <!--[if !IE]>-->
                <object type="application/x-shockwave-flash" data="flash/video/jackeehvideo.swf" width="740" height="482">
                  <!--<![endif]-->
                  <param name="quality" value="high" />
                  <param name="wmode" value="opaque" />
                  <param name="swfversion" value="6.0.65.0" />
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                  <div>
    Here's the link to DD's script that I'm using:
    http://www.dynamicdrive.com/dynamici...edcollapse.htm


    Again, thank you very much. it's eternally appreciated.

    Brian
    Last edited by jamesR; 05-21-2010 at 03:06 PM.

  5. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hi, Brian.

    Here's the problem: you need to use Javascript to send a command to Flash. That's difficult, to say the least. Everything else is easy enough, but somehow you'll need to connect the two. (It's easy to have flash send a command to Javascript, but since flash isn't, as far as I'm aware, really listening for Javascript commands, the other way is harder).

    I'll move this to the Flash section so that someone can (hopefully) tell you how to get flash to listen and pause the video when needed. I also changed the title (please use a descriptive title-- it helps people identify your thread) so hopefully someone will know how to help you in the flash section.


    By the way, one other way to do this would be to destroy the flash object so that it doesn't exist on the page any more. That might be easier; but then you'd have to reload it every time you made it appear and it would lose your place if that matters.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #5
    Join Date
    May 2010
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default JavaScript callback to flash help needed please...:(

    Quote Originally Posted by djr33 View Post
    Hi, Brian.

    Here's the problem: you need to use Javascript to send a command to Flash. That's difficult, to say the least. Everything else is easy enough, but somehow you'll need to connect the two. (It's easy to have flash send a command to Javascript, but since flash isn't, as far as I'm aware, really listening for Javascript commands, the other way is harder).

    I'll move this to the Flash section so that someone can (hopefully) tell you how to get flash to listen and pause the video when needed. I also changed the title (please use a descriptive title-- it helps people identify your thread) so hopefully someone will know how to help you in the flash section.


    By the way, one other way to do this would be to destroy the flash object so that it doesn't exist on the page any more. That might be easier; but then you'd have to reload it every time you made it appear and it would lose your place if that matters.
    Ok, thanks. BTW - sorry about the "No title" bit... won't happen agian.


    Thanks,
    Brian

  7. #6
    Join Date
    May 2010
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Pause flash video using Javascript command

    Ok, here's what I've found...
    http://www.flash-here.com/tutorials/flash_from_js2.html

    The only thing is I need the video to play and stop with the expand and colapse function of the division tag.

    the video is set you auto play when the div tag is expanded to just need it to stop when it is hidden.

    thanks,

    Brian

  8. #7
    Join Date
    May 2010
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    here's what I done thus far...

    I added another frame and moved the video to frame 2.
    I then named the frames: frame one is "stop" and frame 2 is "play"

    I'm thinking if I can get the script to target frame 1 (stop) on the colapse function, that will do it?

    Question is, how to do it? Hmmm, i'm stumped please help me!!!

  9. #8
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    FlashVars

    If you embedded using SWFObject it would be even easier. However...

    The method is simple, You add AS code inside the Flash to pause or play the movie. Set this variable in the HTML as a FlashVar. When div is collapsed the FlashVar sets the variable to the pause function. When opened it sends a FlashVar to resume.

    Unfortunately I don't really have the time right now to build you an example, but if you do a little research you will see how it is done.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  10. The Following User Says Thank You to BLiZZaRD For This Useful Post:

    jamesR (05-24-2010)

Bookmarks

Posting Permissions

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