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

JW PLAYER 5.9 JS errors


Getting a lot of JS errors after upgrading to 5.9:

Happening on a page with mutually exclusive player script:
http://developer.longtailvideo.com/contributors/nyboe/JW_API_xmpl_1-1-3-0.html
HTML5 enabled/Chrome 16

Could not add mouse listeners to controlbar: TypeError: Cannot call method 'addEventListener' of null
jwplayer.js:1Could not add mouse listeners to dock: TypeError: Cannot call method 'addEventListener' of null
jwplayer.js:1Could not add mouse listeners to controlbar: TypeError: Cannot call method 'addEventListener' of null
jwplayer.js:1Could not add mouse listeners to dock: TypeError: Cannot call method 'addEventListener' of null
jwplayer.js:1Could not add mouse listeners to controlbar: TypeError: Cannot call method 'addEventListener' of null
jwplayer.js:1Could not add mouse listeners to dock: TypeError: Cannot call method 'addEventListener' of null
jwplayer.js:1There was an error while handling a listener: TypeError: Cannot call method 'dispatchEvent' of null function (dat) { jwplayer("aplayer1").dispatchEvent("jwplayerPlayerState", dat); }
jwplayer.js:1There was an error while handling a listener: TypeError: Cannot call method 'dispatchEvent' of null function (dat) { jwplayer("aplayer1").dispatchEvent("jwplayerPlaylistItem", dat); }
jwplayer.js:1There was an error while handling a listener: TypeError: Cannot call method 'dispatchEvent' of null function (dat) { jwplayer("aplayer1").dispatchEvent("jwplayerMediaMeta", dat); }
jwplayer.js:1There was an error while handling a listener: TypeError: Cannot call method 'dispatchEvent' of null function (dat) { jwplayer("aplayer1").dispatchEvent("jwplayerMediaMeta", dat); }
jwplayer.js:1There was an error while handling a listener: TypeError: Cannot call method 'dispatchEvent' of null function (dat) { jwplayer("aplayer1").dispatchEvent("jwplayerMediaMeta", dat); }
jwplayer.js:1There was an error while handling a listener: TypeError: Cannot call method 'dispatchEvent' of null function (dat) { jwplayer("aplayer1").dispatchEvent("jwplayerPlayerState", dat); }

13 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

http://developer.longtailvideo.com/contributors/nyboe/JW_API_xmpl_1-1-3-0.html is a very old page, using the 4.X player.

Where are you running the 5.9 player on your own wesbite?

JW Player

User  
0 rated :

The website is not live, but the script worked up until version 5.8.
I'll do some more research.

JW Player

User  
0 rated :

The code I'm using:

$("document").ready(function () {

$('#content').on("click", '.videoplayer, .audioplayer', function (e) {
e.preventDefault();

//Set audio/video file from rel tag
var file_ = $(this).attr('rel');

var height_ = ($(this).attr('class') == 'audioplayer' || $(this).attr('class') == 'audioplayer aplayersmall') ? '48px' : '100%';
var controlbar_ = ($(this).attr('class') == 'audioplayer' || $(this).attr('class') == 'audioplayer aplayersmall') ? 'bottom' : 'over';

//switch skins
var skin_;
switch ($(this).attr('class')) {
case "audioplayer aplayersmall":
skin_ = "modieus_audioplayer_small.xml";
break;
case "audioplayer":
skin_ = "modieus_audioplayer.xml";
break;
default:
skin_ = "modieus.xml";
}

//Show preloader
$('#preloader').fadeIn(300, function () {});


//Mutually exclusive players
if (OldPlayerWrapper != null) {
removeOldPlayer(OldPlayerWrapper, oldCode);
}
OldPlayerWrapper = $(this).parent();
oldCode = $(this).parent().html();
//Init jwplayer
jwplayer($(this).attr('id')).setup({
'skin': 'http://domain.com/css/jwplayer_skins/modieus/' + skin_ + '',
'controlbar': controlbar_,
'icons': 'false',
'width': 'auto',
'height': height_,
'abouttext': 'About',
'aboutlink': 'http://domain.com/info/about',
'stretching': 'fill',
'autostart': 'true',
'levels': [{
'file': file_
}, {
'file': file_ /*use webm or ogg*/
}],
'modes': [
{
type: 'html5'
},
{
type: 'flash',
src: 'http://domain.com/js/player.swf'
},
{
type: 'download'
}]
});

//Player ready event
jwplayer($(this).attr('id')).onPlay(function () {
$('#preloader').fadeOut(300, function () {});
});
//Player buffer event
jwplayer($(this).attr('id')).onBuffer(function () {
$('#preloader').fadeIn(300, function () {});
});

jwplayer($(this).attr('id')).onIdle(function () {
removeOldPlayer(OldPlayerWrapper, oldCode);
});

});

JW Player

User  
0 rated :

HTML looks like this:

<div class="videoplayer_wrap">
<div class="videoplayer" id="vplayer1" rel="http://content.bitsontherun.com/videos/bkaovAYt-injeKYZS.mp4">
<div class="videoplayer_replace">
<div class="videoplayer_replace_playicon"></div>
<img src="http://test.com/testimage.jpg"/>
</div>
</div>
</div>

JW Player

User  
0 rated :

Remove Old Player function:
//Mutually exclusive players
var OldPlayerWrapper = null;
var oldCode;

function removeOldPlayer(OldPlayerWrapper, oldCode) {
OldPlayerWrapper.html(oldCode);
OldPlayerWrapper = null;
}

JW Player

User  
0 rated :

I found out what is causing the error:
Line 4307
_container.id = _wrapper.id + "_video";

This somehow automatically adds "_video" to the player id (id="aplayer1_video")
I removed just the + "_video" part and no more errors are shown but the player's controlbars aren't working any more.

JW Player

User  
0 rated :

I simplified the code above for easier debugging.
The code below works fine using Flash mode but using html5 mode it doesn't.
After the first click everything goes as expected but after one video has finished playing and the container is reset the second click causes the errors I have posted in my first post.

$("document").ready(function () {

var oldPlayer = null;

function removeOldPlayer(oldPlayer) {
jwplayer(oldPlayer).remove();
oldPlayer = null;
}

$('#content').on("click", 'div.videoplayer', function (e) {
e.preventDefault();


if (oldPlayer != null) {
removeOldPlayer(oldPlayer);
}

oldPlayer = $(this).attr('id');

jwplayer($(this).attr('id')).setup({
'width': '300px',
'height': 200px,
'file': 'http://content.longtailvideo.com/videos/flvplayer.flv',
'modes': [

{
type: 'flash',
src: 'http://mydomain.js/player.swf'
},
{
type: 'html5'
},
{
type: 'download'
}]
});

jwplayer($(this).attr('id')).onIdle(function () {
removeOldPlayer(oldPlayer);
});

});

JW Player

User  
0 rated :

I set up a test.
Press play1->play2->play1(breaks with errors)

http://dl.dropbox.com/u/570089/jw/index.html

Maybe someone can help me out with that one.
Thnx

Ethan Feldman

JW Player Support Agent  
0 rated :

Ah, it might have to do with this – http://developer.longtailvideo.com/trac/ticket/1584

JW Player

User  
0 rated :

I have no idea - you are wearing the tie, tell me :)
The ticket says it's a flash related issue.
The problem I am having is HTML5 only.
I am also completely removing the the player instance using jwplayer(oldPlayer).remove().
I have no idea why it is behaving like that.
I tried digging around in the source to find a solution, but 10000 lines is just too much.


Ethan Feldman

JW Player Support Agent  
0 rated :

Its related. I would use 5.8 for now.

JW Player

User  
0 rated :

When is a fix going to be expected?
Is there a way to follow the tickets?

Ethan Feldman

JW Player Support Agent  
0 rated :

5.10 is the milestone. Keep look at the ticket for updates.

This question has received the maximum number of answers.