问题描述:

Below is the code in which changeme is the text i want to change on the click of the button.

HTML code and JS is below:

1) whatever user input in field will be capture and replace with changeme if the JavaScript and then with the new JavaScript page is loaded.

If someone will help me it will be really great help

<form>

Stream ID: <input id="csi" name="q" placeholder="Custom Streame Id">

<input id="btn" type="submit" value="View">

</form>

<script type="text/javascript">

jwplayer("test").setup({

aboutlink: "http://domain.com",

abouttext: "DOMAIN",

streamer: 'link',

file:'changeme'

});

网友答案:

To change the playing file dynamically use the load() function:

jwplayer().load("newfile").play();
网友答案:

Base on DevZer0 solution, you can try this

<form>
Stream ID: <input id="csi" name="q" placeholder="Custom Streame Id">
<input id="btn" type="submit" value="View" onclick="loadnewfile();">
</form>

<script type="text/javascript">
   jwplayer("test").setup({
       aboutlink: "http://domain.com",
       abouttext: "DOMAIN",
    streamer: 'link',
    file:'ORIGINAL_FILE'    
   });

   function loadnewfile(){
      jwplayer().load($('#btn').val()).play();
   }
</script>

Assuming you have jQuery loaded in the document.

网友答案:
 <script type="text/javascript">
 jwplayer("container").setup({
 file: "http://content.bitsontherun.com/videos/i8oQD9zd-640.mp4",
 image: "http://content.bitsontherun.com/thumbs/i8oQD9zd-640.jpg",
 title: "Tears of Steel"

 });
 function playTrailer(key) { 
 jwplayer().load([{
 file: "http://content.bitsontherun.com/videos/"+key+"-640.mp4",
 image: "http://content.bitsontherun.com/thumbs/"+key+"-640.jpg"
 }]);
 jwplayer().play();
 }
 function playstream(key) { 
 jwplayer().load([{
 file: "+key+",
 streamer: 'rtmp://hideipforsecurity/golive',
 type:'rtmp'

 }]);
 jwplayer().play();
 }


 </script>




   <p>Live Streamers:</p>
   <ul>
   <li><a href="javascript:playTrailer('i8oQD9zd')">Tears of Steel</a></li>
   <li><a href="javascript:playTrailer('3XnJSIm4')">Sintel</a></li>
   <li><a href="javascript:playTrailer('bkaovAYt')">Big Buck Bunny</a></li>
   <li><a href="javascript:playstream('idx')">stream</a></li>
   </ul>

above is what i achieved. now when i click "stream" it gives me an error in jwplayer ERROR PLAYING list : no playable source found. if anyone knowwhats rong help me

相关阅读:
Top