Results 1 to 10 of 10

Thread: change video src

  1. #1
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default change video src

    Hello,

    I need a script that will allow my users change the video they are viewing by clicking a link without refreshing the page. For example, when the user comes to a page they will be shown a default video with three links underneath it. When they click on the link the video will change, but the entire page will not refresh.

    Any guidance would be greatly appreciated.

    Thanks in advance!

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,336
    Thanks
    30
    Thanked 137 Times in 132 Posts
    Blog Entries
    32

    Default

    You could do this, using an iframe
    Code:
    <div style="position:absolute;left:20%;top:20%;height:60%;width:60%">
    <iframe id="myvideo" src="http://www.youtube.com/watch_popup?v=vt4X7zFfv4k" 
    style="position:relative;height:100%;width:100%"></iframe>
    <div style="text-align:center">
    <a href="#null" onclick="document.getElementById('myvideo').src='http://www.youtube.com/watch_popup?v=vt4X7zFfv4k'">Soccer</a> | 
    <a href="#null" onclick="document.getElementById('myvideo').src='http://www.youtube.com/watch_popup?v=bT4WGQVmQf8'">Ciocarlia</a> | 
    <a href="#null" onclick="document.getElementById('myvideo').src='http://www.youtube.com/watch_popup?v=Wz1W_omigwg'">Ghost</a> | 
    <a href="#null" onclick="document.getElementById('myvideo').src='http://www.youtube.com/watch_popup?v=LRBIVRwvUeE'">Helpdesk</a>
    </div>
    </div>
    Arie Molendijk.

  3. #3
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,935
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    11

    Default

    Iframes are probably the easiest method but depending on your needs, you could use JW's FLV Media Player: http://www.longtailvideo.com/players/jw-flv-player/ along with their Javascript API.

    I have a working example of this setup with clickable links here: http://www.jemcon.org/videovault.php

    I've also attached a stripped down version of the page, along with all the necessary files, for demonstration purposes. You'll need to have this package uploaded to your server to see it working (you'll probably have to replace the URLs of my video files with your own in the html file as I cant remember if my .htaccess file will block video hotlinking from other domains). Please refer to JW's own website for the latest downloads and all necessary documentation.

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,336
    Thanks
    30
    Thanked 137 Times in 132 Posts
    Blog Entries
    32

    Default

    Beverley, that's nice.
    But with an iframe, we can directly show, for instance, a youtube movie, without having to download it first to our hard disk (and upload it to our personal site afterwards). That would also be possible with the chromeless youtube player. Would it be possible with the FLV player?

    Arie Molendijk.

  5. #5
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,935
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    11

    Default

    Yes, you can stream videos uploaded to YouTube directly into the JW player, although I havent tried it myself.

    With the download package from JW's official website there is a youtube plugin file called "yt.swf" that you just upload to the same location as the "player.swf" file. You can then reference the YouTube URLs in the html (or xml playlist, whichever you're using).

    Hope that helps.

    PS - you might also find this page useful: http://home5.inet.tele.dk/nyboe/flash/ as its a one-stop-shop to lots of FLV video player examples and other important documentation/tools.
    Last edited by Beverleyh; 08-24-2009 at 01:49 PM. Reason: additional link added

  6. The Following User Says Thank You to Beverleyh For This Useful Post:

    molendijk (08-24-2009)

  7. #6
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,336
    Thanks
    30
    Thanked 137 Times in 132 Posts
    Blog Entries
    32

  8. #7
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,935
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    11

    Default

    No problem Arie.

    Something else which may prove useful: A small free tool to convert videos to a compatiable .mp4 format, ready for JW's FLV Player.
    It needs free QuickTime 7 installed beforehand to function properly and also supports batch conversion.
    http://www.videohelp.com/tools/3GP_Converter

    Open the setup file and choose English from the dropdown menu, then choose your video format "Model".
    The "MP4, for PSP" Model (3rd option from the bottom) works best with the FLV Player - play with the different quality presets within this Model to find one that best suits your needs.

    You can also edit the "Transcoding.ini" file to set your own custom parameters such as framerate, video dimensions and bitrate and audio frequency, etc.
    Last edited by Beverleyh; 08-24-2009 at 02:51 PM. Reason: QT7 and "batch conversion" comment added

  9. #8
    Join Date
    Oct 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks Beverleyh!

    But does it work on all operating systems and cross browsers? Like Firefox on Linux, Firefox on Windows XP, IE on windows etc. If this is true, then its really great using it!!

    -
    Carox

  10. #9
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,935
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    11

    Default

    I have definitely used/tested it myself on XP, Vista and Windows7 all using IE6/7/8, FF, Safari, Chrome and Opera.
    I don't have a MAC myself, but I know users who tested it for me on MAC in FF and Safari and its all peachy there too!
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  11. #10
    Join Date
    Mar 2009
    Posts
    74
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Hi Beverly, I got it all uploaded and see the player but after replacing your link to your .flv video with a youtube URL. The progress circles and circles without playing anything.

    I should note. I want to do exactly what you have on your page, except I do not want to host the videos. I hotlink all of my videos back to youtube.

    Thank you
    Last edited by igotregistered; 07-13-2011 at 12:42 AM.

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
  •