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

Player removal using remove()


Hello,

using the latest player (5.3), I have run into a problem using the

jwplayer("container").remove();

function.

For some strange reason, the function doesn't work in Firefox but removes the created Player object correctly when run in Safari.

If this is indeed the case, is there another way to remove the player and return the DOM to its original state?

To see what I am talking about, open up:

http://www.longtailvideo.com/players/

and run: jwplayer().remove(); in the console.

I'd be happy about any help.

Seb

21 Community Answers

JW Player

User  
-2 rated :

I also am unable to get remove() to do anything.

JW Player

User  
0 rated :

It looks like it's because outerHTML is used for this function (in destroy()), which Firefox doesn't support.

JW Player

User  
0 rated :

You may want to try the solution on this thread:

http://www.longtailvideo.com/support/forums/jw-player/javascript-interaction/14969/firefox-throws-javascript-error-when-setting-listeners-after-ajax-replacement

Bob

JW Player

User  
0 rated :

I'm experiencing this issue as well which is causing problems in my code. I have a slideshow that has content, which may include videos, replaced with AJAX each slide. The video loads fine once and I'm able to remove it successfully with Safari. Firefox doesn't destroy it, so if the user goes back to a previous slide and tries to load the video it fails (I'm assuming because the JWPlayer object already exists).

Any suggestions? I've tried jwplayer().destroy() and jwplayer().remove(). Destroy works in webkit and fails in mozilla. Is there any other way to destroy the object?

Jeff

JW Player

User  
0 rated :

I also get the following error every time I run the jwplayer('container').destroy() in webkit:

TypeError: Result of expression 'document.getElementById(P.id+"_elements")' [null] is not an object.

It does work though.

JW Player

User  
0 rated :

Which version is this fixed in?

I can't use the latest version because it's breaking things in IE8, and am currently using version 5.4.1530 which is throwing the error 'document.getElementById(P.id + "_elements") is null' in Firefox 3.6.

thanks,
Julia

JW Player

User  
0 rated :

I can't even get the latest verson to load anything in IE8 :(

Do you offer backward compatibility with the latest version? How far back does your compatibility go? IE7? IE6?

(I'll try and set up a test page for you to look at)

cheers for your help,
Julia

JW Player

User  
0 rated :

Internet Explorer 8

Okay, on the 5.4 version the player loads the video, but if you try closing (triggering the 'remove' call) and playing again, the video throws an error and won't play again.

http://dev.fortune-cookie.com/interface/jwplayer/UIDTemplates/videotest5.4.html

Using the latest version of the player (5.5) the video simply doesn't load at all in IE8! IE9 is fine with this version, and Firefox 3.5 as well.

http://dev.fortune-cookie.com/interface/jwplayer/UIDTemplates/videotest5.5.html

(the video forms part of a carousel, and when the play button is triggered the view port opens to show the whole video window)

Any thoughts, gratefully received.

JW Player

User  
0 rated :

@Julia

Just above your closing body element you have the following

bc.. <!--[if IE 9]>
<script type="text/javascript" src="../resources/jwplayer/jwplayer5.5.js"></script>
<![endif]-->
<!--[if lte IE 8]>
<script type="text/javascript" src="../resources/jwplayer/jwplayer5.5.js"></script>
<![endif]-->
<![if !IE]>
<script type="text/javascript" src="../resources/jwplayer/jwplayer5.5.js"></script>
<![endif]>



simply having the statement

bc.. <script type="text/javascript" src="../resources/jwplayer/jwplayer5.5.js"></script>



is suffice

You also have in your
bc.. players: [
{ type: "html5" },
{ type: "flash", src: "../Resources/jwplayer/player.swf" }
],



try using player 5.5 changing *players: to modes:*

JW Player

User  
0 rated :

@Julia

I forgot to mention something in my post above.

This may be considered outside the scope of this forum but IMHO relevant.

Something to consider when using conditional statements as in your case which is seen twice; firstly in the head element and secondly just above the closing body element.

Ideally one doesn't want to use conditional statements as they do affect the overall performance of a web site and/or page.

BUT conditional statements are a necessary evil so; so how can we improve the effect of conditional statements has.

In tour code at the top in your head element, you may want to include the following

bc.. <![if IE]><![endif]>




here is something worthwhile noting/reading

http://webforscher.wordpress.com/2010/05/20/ie-6-slowing-down-ie-8/

Hope this gives you some insight.

JW Player

User  
0 rated :

@willie

Thanks for your help, I was just using the conditional comments to separate the different versions of JWPlayer in the different browsers. I'm hoping to only use one statement if I can get 5.5 to work.

I've tried changing "players:" to "modes:", unfortunatly this hasn't worked.
Using 5.5 - IE8 again just doesn't load flash,
Using 5.4 - IE8 doesn't load the video but loads flash.

Any other suggestions?

Thanks again for your help.

JW Player

User  
0 rated :

@Zach - oh, I thought I was using the trunk version! What's the trunk version number? I'll check against what I've got..

JW Player

User  
0 rated :

I've another issue while using remove() in html5 mode...

I'm building a wizard to help people play around with a plugin I made and here is what happens.

1. Page loads, the wizard current config is applied via setup();
2. Player behaves as expected.
3. I change the config of the wizard, then apply it...
4. Player is removed via remove();
5. A new player config is used in setup(); after few seconds...
6. The player re-appear but it's buggy...
(The "loading wheel" never disappear, my plugin doesn't).

Instead of the minified version of jwplayer.js, I use the debug version from
http://developer.longtailvideo.com/trac/browser/trunk/fl5/js/bin-debug/jwplayer.js
It makes it easier to debug...
I renamed it to jwplayer.debug.js in order to avoid file conflicts.

Here are the error messages I get:
When the player is first loaded I see this log in Firebug:
bc.. There was an error while handling a listener: TypeError: childNodes[childNode].id is undefined _playlistHandler()jwplayer.debug.js (line 494)



Same message is shown when I remove() and re- setup() the player + these other messages

bc.. Could not add mouse listeners to controlbar: TypeError: _root is nulljwplayer.debug.js (line 496)

Could not add mouse listeners to dock: TypeError: _root is nulljwplayer.debug.js (line 496)

Could not add mouse listeners to controlbar: TypeError: _root is nulljwplayer.debug.js (line 496)

Could not add mouse listeners to dock: TypeError: _root is nulljwplayer.debug.js (line 496)

displayarea is null
displayarea.appendChild(div);
jwplayer.debug.js (line 3992)






Then we I hit play:

bc.. Could not add mouse listeners to controlbar: TypeError: _root is nulljwplayer.debug.js (line 496)

There was an error while handling a listener: TypeError: childNodes[childNode].id is undefined _loadedHandler(evt)jwplayer.debug.js (line 494)

There was an error while handling a listener: TypeError: jwplayer("player") is null function()jwplayer.debug.js (line 494)

There was an error while handling a listener: TypeError: jwplayer("player") is null function()jwplayer.debug.js (line 494)

There was an error while handling a listener: TypeError: jwplayer("player") is null function()jwplayer.debug.js (line 494)

There was an error while handling a listener: TypeError: jwplayer("player") is null function()
jwplayer.debug.js (line 494)




Then the loading wheel...

Any idea?
I'll put my "wizard" online so you can test it by yourself
http://files.loadvars.com/wizard/

I recommend using Firefox+Firebug
I'm using the latest version of jwplayer... 5.9

To test the easiest way is to
1. Load the page
2. Hit play and rollover the player's timeline
3. Hit "Update and preview code" wait and retry step 2

Thank you for your help!

-Franois-

JW Player

User  
0 rated :

Has somebody from Longtail Video's team read my last message?
Zach, maybe?
I'd like to find a way to implement remove() smoothly...
Thanks.

JW Player

User  
0 rated :

Same problem here...

Ethan Feldman

JW Player Support Agent  
0 rated :

Di you have a link?

JW Player

User  
0 rated :

Yes,
my link is here: http://files.loadvars.com/wizard/

For instructions, follow my previous post:
(Wed, 2012-02-08 15:02)

Thank you

Ethan Feldman

JW Player Support Agent  
0 rated :

Thanks, will take a look.

Pablo

JW Player Support Agent  
0 rated :

@Franois -

This is unfortunately a known bug in 5.9. We’ll try to get to this one quickly.

http://developer.longtailvideo.com/trac/ticket/1578

JW Player

User  
0 rated :

is there any progress on this?

Ethan Feldman

JW Player Support Agent  
0 rated :

Try 5.10

This question has received the maximum number of answers.