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

Could not add internal listener


I'm trying to add some event listeners to the player but I get this error:

"Could not add internal listener".

First I create the player with setup() and then I add events:
jwplayer("placeplayer_"+video_id).onPlay(function(){...});
jwplayer("placeplayer_"+video_id).onPause(function(){...});

Link: http://www.tvi.iol.pt

Thank you!

7 Community Answers

Todd

JW Player Support Agent  
0 rated :

I read through your source code and I think you should try using just ‘placeplayer’ as your div id.
If this is the only video on the page, you can use jwplayer() without the div id.

Hope this helps,
Todd

david.beja

User  
0 rated :

No, I have multiple videos on that page.
The slider can have more than one video, so I have to have different ids for each video.

Todd

JW Player Support Agent  
1 rated :

From what I can tell, when you are calling createNewPlayer and sending the div_id to your video, the only name I can see passed is ‘placeplayer’.
Where are you appending the video id onto ‘placeplayer’?

You can also refer to each individual player on the page using the order in which they were first set up, meaning:
jwplayer(0) is the first jwplayer setup,
jwplayer(1) is the second,
jwplayer(2) is the third…

david.beja

User  
0 rated :

In main.js, on the animationComplete callback of the home slider, I have something like:

IOL.createNewPlayer('placeplayer_'+video_id, video_id, thumb_id, duration, '7811748/tvi_web_pt/homepage/VIDEO', '360', '270','');

I debug this line and the video_id seems ok. And the video plays in the right location.

Todd

JW Player Support Agent  
0 rated :

Perhaps it would be easier to keep the name of the video player div the same, but then use Javascript functions to change to a new video. Here’s a simple example:

<script type="text/javascript"> function playThisVideo(fileName) { jwplayer('video').load([{ file: fileName }]); jwplayer().play(); } </script><div id="video">Loading the player …</div>

<br> <a href="javascript:playThisVideo('bunny.mp4');">Big Buck Bunny</a><br> <a href="javascript:playThisVideo('sintel.mp4');">Sintel</a><br> <a href="javascript:playThisVideo('tears.mp4');">Tears of Steel</a>
<script> jwplayer('video').setup({ file: 'bunny.mp4', height: '400px', autostart: true }); </script>

david.beja

User  
0 rated :

But is this the problem that doesn't let me add listeners for the player events (play, stop, .,..) ?

Thank you!

Todd

JW Player Support Agent  
0 rated :

You can add the listeners after your setup:

jwplayer(‘video’).onPlay(function(){
console.log(‘Video is playing’);
})

jwplayer(‘video’).onPause(function(){
console.log(‘Video is paused’);
})

jwplayer(‘video’).onComplete(function(){
console.log(‘Video complete’);
})

This question has received the maximum number of answers.