Support » Plugins and Hacks » dynamically change embed video source with links?

dynamically change embed video source with links?

  • Hi,
    Does JW Player have a way to dynamically change embedded video source by simply clicking on a link (with new source)?

    I know there is a way to easily do this with HTML 5 & java script, but I’m a total noob with little knowledge/understanding, without an ABC explanation + examples instead of terms with no example I just don’t get it.

    I have a theme “responsive” that has an input box for the home page in the backend. I can easily put a video or image or html there. I want to great a video frame with a default video, then when someone clicks on the links (or thumb image) below that video frame the source changes to the new video.


Viewing 2 replies - 1 through 2 (of 2 total)
  • I came across this code that uses javascript/css/html which is suppose to dynamically change source for embedded videos but it doesn’t work. I have tried it both in a wp-page and html page.

    		<style media="screen" type="text/css">
    .wrap            { margin:30px auto 10px; text-align:center }
    .container       { width:440px; height:300px; border:5px solid #ccc }
    p                { font: 10px/1.0em 'Helvetica',sans-serif; margin:20px }
    $("input[type=button]").click(function() {
        var $target         = "testvid_"+$(this).attr("rel");
        var $content_path   = "http://www.mywebsite.net/videos/";
        var $vid_obj        = _V_("div_video");
        // hide the current loaded poster
        $vid_obj.ready(function() {
          // hide the video UI
          // and stop it from playing
          // assign the targeted videos to the source nodes
          // replace the poster source
          // reset the UI states
          // load the new sources
    </script>	</head>
    		<section class="container wrap">
      <video id="div_video" class="video-js vjs-default-skin" controls preload="auto" width="440" height="300" poster="http://www.mywebsite.net/videos/testvid_01.png" data-
        <source src=""  type="video/mp4">
        <source src=""  type="video/ogg">
        <source src=""  type="video/webm">
    <div class="wrap">
      <input rel="01" type="button" value="load video 1">
      <input rel="02" type="button" value="load video 2">
      <input rel="03" type="button" value="load video 3">

    I used file names:
    testvid_01.mp4, testvid_01.ogv, testvid_01.webm
    testvid_02.mp4, testvid_02.ogv, testvid_02.webm
    testvid_03.mp4, testvid_03.ogv, testvid_03.webm
    testvid_01.png, testvid_02.png, testvid_03.png

    it loads the player and the 01.png image, but clicking on the link does nothing.

    Plugin Author JW Player


    Where did you try this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘dynamically change embed video source with links?’ is closed to new replies.