Skip navigation
Currently Being Moderated

Playing video on a html with jquery

Dec 21, 2011 6:44 AM

Hi

 

I have a php/sql database that has thumb nails and videos in swf format and flv. On my html page I have an swf player. I have echoed

the thumbnails and have the url of the videos. How can I get the video url playing on the player after a person clicks the thumbnail with

out xml. Just by passing the url to the player. Kind of how youtube works thanks.

 

I have hand some sucess with xml passing but this can`t  work in this aspect. So I have been investigating jquery and other alternatives.

 

Hope you can help.

 

Thanks.

 
Replies 1 2 Previous Next
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 21, 2011 8:50 AM   in reply to Tony404

    you're loading the xml with jquery but all the thumbnails are in your swf?

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 22, 2011 5:22 PM   in reply to Tony404

    what part of your project is in the swf?  the video player with the play,pause,stop controls?  so, only the video's url needs to be passed to the swf embedded in your html page?

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 23, 2011 10:49 AM   in reply to Tony404

    in your html, add the following to your javascript/jquery:

     

     

    function thisMovie(movieName) {

             if (navigator.appName.indexOf("Microsoft") != -1) {

                 return window[movieName];

             } else {

                 return document[movieName];

             }

         }

     

         function sendToActionScript(flv) {

             thisMovie("put_your_embedded_swfs_name_here_without_the_dot_swf").sendToActionScript(flv);

         }

     

    // when you want to pass the url to flash use:

     

    sendToActionScript("yourflvname.flv");

     

    ////////////// and in your embedded swf with the player use:

    import flash.External.ExternalInterface;

     

    ExternalInterface.addCallback("sendToActionScript", playFLV);

     

    function playFLV(flv):Void{

    yourflv_pb.contentPath=flv;

    //do whatever else

    }

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 26, 2011 11:20 AM   in reply to Tony404

    are you using as2 or as3?

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 26, 2011 8:48 PM   in reply to Tony404

    1.  you're posting in the as1/as2 forum

     

    2.  you should be seeing error messages IF you're using as3.

     

    3.  what's the name of the flv you're trying to play?

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 27, 2011 7:16 AM   in reply to Tony404

    as2:

     

     

     

     

    //Action script

    import flash.External.ExternalInterface;

     

    ExternalInterface.addCallback("sendToActionScript", playFLV);

     

    function playFLV(flv):Void{

    myVid.contentPath=flv;

    myVid.play();

    }

     

     

    p.s.  please mark/helpful/correct responses.

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 27, 2011 4:53 PM   in reply to Tony404

    try

     

     

    <input type="button" value="play" onClick="sendToActionScript('../Videos/teleme.flv');" />

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 27, 2011 9:04 PM   in reply to Tony404

    put all your files in the same directory and test so you don't have any path issues.  once you get that working you can work on setting up your files more conveniently.

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 7, 2012 9:39 AM   in reply to Tony404

    it's very unlikely there's a problem with jquery.  i have almost as much experience coding with jquery as i do with actionscript and i've found it to be very robust.

     

    p.s.  i only offer free help via the adobe forums.  if you want me to test/correct your files, you'd need to hire me.

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 7, 2012 10:33 AM   in reply to Tony404

    i don't see where you're using jquery and there's faulty swfobject code.  try:

     

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

     

    <script type="text/javascript">

     

     

     

    function thisMovie(movieName) {

     

             if (navigator.appName.indexOf("Microsoft") != -1) {

     

                 return window[movieName];

     

             } else {

     

                 return document[movieName];

     

             }

     

         }

         function sendToActionScript(flv) {

     

             thisMovie("JQplay").sendToActionScript(flv);

     

         }

     

    </script>

     

     

    <title>Qplayer</title>

    </head>

     

    <body>

    <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="400">

      <param name="movie" value="JQplay.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="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="JQplay.swf" width="550" height="400">

        <!--<![endif]-->

        <param name="quality" value="high" />

        <param name="wmode" value="opaque" />

        <param name="swfversion" value="6.0.65.0" />

        <param name="expressinstall" value="expressInstall.swf" />

        <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->

        <div>

          <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>

          <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.g if" alt="Get Adobe Flash player" width="112" height="33" /></a></p>

        </div>

        <!--[if !IE]>-->

      </object>

      <!--<![endif]-->

    </object>

     

    <br/>

    <input type="button" value="play" onClick="sendToActionScript('teleme.flv');" />

     

    </body>

    </html>

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 7, 2012 9:53 PM   in reply to Tony404

    you must publish for fp 8 or better.

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 8, 2012 9:27 AM   in reply to Tony404

    that's the flash player version.  you're publishing for flash player 6 which does not support the externalinterface class.

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 8, 2012 12:58 PM   in reply to Tony404

    if you publish for flash player 8 or better you can use the externalinterface class.  otherwise, you have to use getURL().

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 8, 2012 6:00 PM   in reply to Tony404

    you're correct.  you can use getURL to communicate from actionscript to javascript but not vice-versa.

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 8, 2012 7:16 PM   in reply to Tony404

    what version of the flash program are you using?

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 8, 2012 10:34 PM   in reply to Tony404

    if you have cs5 why don't you publish for fp 8 or better??

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 11, 2012 12:06 PM   in reply to Tony404

    use:

     

    myVid.content=paramObj.itemCode;

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 11, 2012 2:50 PM   in reply to Tony404

    my errror.  that should be:

     

    myVid.source=paramObj.itemCode;

     
    |
    Mark as:
  • kglad
    63,084 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 11, 2012 4:24 PM   in reply to Tony404

    you're welcome.

     
    |
    Mark as:
1 2 Previous Next

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points