Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Video load Wordpress


Hi I have created my thumbs and want to call the video into the player which is at the top of the page.

This is the javascript that I have put into the link column for the gallery

"img src="#" onclick="jwplayer().load({file:'http://domain.com../streams/HTVG_2.mp4'});jwplayer().play();""

The video attempts to load and the player twirls but no success. Is any one clued up on what how I can resolve this.

A demonstration can be seen here http://www.christiantvonline.net/0711c/

Many thanks

5 Community Answers

Alex

JW Player Support Agent  
0 rated :

Hi there,

You wouldn’t be able to call .play() right after .load() because the player won’t be finished loading the new file before you are telling it to start playing it. I played around with your code a little bit and I think you will find success if you add this code right after you embed the player (via <script src="//content.jwplatform.com/players/DlkGvQyU-cZPlrtAo.js"></script>):

<script>
  var newContentLoaded;

  function loadNewContent(url) {
    newContentLoaded = true;
    jwplayer().load({
      file: url
    });
  }

  jwplayer().on("playlistItem", function() {
    if (newContentLoaded) {
      jwplayer().play(true);
    }
  });
</script>

That way, you can change the value for the “onclick” attribute for your thumbnails to call the loadNewContent function, like this:

<a href="#" onclick="loadNewContent('http://christiantvonline.net/streams/HTVG_2.mp4');" title=".........(code continues)

I hope that makes sense. Please let me know if you need any more help or have any other questions.

Thank you!

kay

User  
0 rated :

Thanks for your time and wisdom Alex.

I have tried to implement the above code and I am still getting almost the same response.

I am not an expert on javascript maybe that is where I am stuck

This is what I am trying to put into the link field of Wordpress gallery

<a href="#" onclick="loadNewContent('http://christiantvonline.net/streams/HTVG_2.mp4');"

I have three fields Filenme (whic is the jpeg), Description and link(Where the thumbnail will point to)

This is what the code view of my wordpress page looks like.

<script src="//content.jwplatform.com/players/DlkGvQyU-cZPlrtAo.js"></script>
<script>
var newContentLoaded;
function loadNewContent(url) {
newContentLoaded = true;
jwplayer().load({
file: url
});
}
jwplayer().on("playlistItem", function() {
if (newContentLoaded) {
jwplayer().play(true);
}
});
</script>

Could it be that I am imputting the syntax incorrectly under my link column.

Alex

JW Player Support Agent  
0 rated :

Can you try not using the onclick part of the <a> element and putting the following into the href attribute:

javascript:loadNewContent('http://christiantvonline.net/streams/HTVG_2.mp4');

so that your <a> element would look like this:

<a href="javascript:loadNewContent('http://christiantvonline.net/streams/HTVG_2.mp4');">

If that doesn’t work, is it possible you can give me a link to a page where I can see this?

Thank you.

KAYODE FAITH

User  
0 rated :

Thanks Alex this worked, you are a genius.

javascript:loadNewContent('http://christiantvonline.net/streams/revivalkay2013_sun01062013.mp4');

Really appreciate it, Have a good weekend.

K

Alex

JW Player Support Agent  
0 rated :

I’m glad it worked for you!

This question has received the maximum number of answers.