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

onError handling


I'm trying to test out error-handling code, and my first test was to set a bad URL (404).

onError was called with "Error #2032".

Is there any list of message values? I'd like, if possible, to handle the error differently depending on the cause of error, so knowing why there was an error would help.

Is this format a safe assumption:
bc.. var result = /^Error #(\d+)$/.exec(message)
if (result) {
if (result == "2032") {
} else if (result = "<some other number>") {
...
}
}

7 Community Answers

JW Player

User  
0 rated :

a list of AS3 runtime errors can be found here:bc.. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/runtimeErrors.html


you can find the list of errors that the JW Player will report by looking through the source code:bc.. http://developer.longtailvideo.com/trac/browser

JW Player

User  
0 rated :

I can't seem to get onError to fire in Firefox, IE or Chrome. Other events fire just fine and I'm able to write various event handlers for them.

bc.. onError: function(event) {
alert('error');
}


...never pops up the alert when the player widow displays an error (like, for example, an error such as 2032 or an HTTP 500 error).

Does anyone have a sample of error code that should work? Or is onError just not triggered in the circumstances I'm describing?

Thanks.

JW Player

User  
0 rated :

the *onError* event seems to be working on this Test Page:bc.. http://willswonders.myip.org:8088/HTML5/JW Player HTML5-Beta3-01.html


JW player v5.3.1397

the second track is purposely broken, so when you select the second track, you should see:bc.. Position updated: 7.36
Stopped
Playlist Item: 1
Buffering
Stopped
Error: Error #2032
as well as an "Error #2032" in the video displayarea...

JW Player

User  
0 rated :

Hey noone, thanks for checking out my issue. In Firefox, IE and Chrome all three playlist items on that page play for me. So I can't test the error you set up. Maybe it's on a different page?

JW Player

User  
0 rated :

there are four tracks in the playlist...

the second track is broken (missing the "h" before "ttp://...")...

if you select the second track, "Error #2032" will show in the displayarea and in the textarea...

bc.. <?xml version="1.0" encoding="UTF-8"?>
<playlist xmlns="http://xspf.org/ns/0/" xmlns:jwplayer="http://developer.longtailvideo.com/trac/wiki/FlashFormats" version="1">
<title>Example XSPF playlist for the JW Player</title>
<info>http://www.longtailvideo.com</info>
<trackList>
<track>
<creator>The Peach Open Movie Project</creator>
<title>1: Big Buck Bunny - FLV Video</title>
<info>http://www.bigbuckbunny.org/</info>
<annotation>Big Buck Bunny is a short animated film by the Blender Institute, part of the Blender Foundation. Like the foundation's previous film Elephants Dream, the film is made using free and open source software.</annotation>
<location>http://www.longtailvideo.com/jw/upload/bunny.flv</location>
<image>http://www.longtailvideo.com/jw/upload/bunny.jpg</image>
<jwplayer:newsticker.link>http://www.google.com/</jwplayer:newsticker.link>
<jwplayer:newsticker.text>THIS IS THE 1st VIDEO</jwplayer:newsticker.text>
<jwplayer:captions.file>captionsaaa.xml</jwplayer:captions.file>
</track>
<track>
<creator>The Peach Open Movie Project</creator>
<title>2: Big Buck Bunny - MP3 Audio with thumbnail image</title>
<info>http://www.bigbuckbunny.org/</info>
<annotation>Big Buck Bunny is a short animated film by the Blender Institute, part of the Blender Foundation. Like the foundation's previous film Elephants Dream, the film is made using free and open source software.</annotation>
*<location>ttp://www.longtailvideo.com/jw/upload/bunny.mp3</location>*
<image>http://www.longtailvideo.com/jw/upload/bunny.jpg</image>
<jwplayer:newsticker.link>http://www.aol.com/</jwplayer:newsticker.link>
<jwplayer:newsticker.text>THIS IS THE 2nd VIDEO</jwplayer:newsticker.text>
<jwplayer:captions.file>captionsbbb.xml</jwplayer:captions.file>
</track>
<track>
<creator>The Peach Open Movie Project</creator>
<title>3: Big Buck Bunny - PNG Image with start</title>
<info>http://www.bigbuckbunny.org/</info>
<annotation>Big Buck Bunny is a short animated film by the Blender Institute, part of the Blender Foundation. Like the foundation's previous film Elephants Dream, the film is made using free and open source software.</annotation>
<location>http://www.longtailvideo.com/jw/upload/bunny.png</location>
<image>http://www.longtailvideo.com/jw/upload/bunny.jpg</image>
<meta rel="duration">20</meta>
<meta rel="start">10</meta>
<jwplayer:newsticker.link>http://www.yahoo.com/</jwplayer:newsticker.link>
<jwplayer:newsticker.text>THIS IS THE 3rd VIDEO</jwplayer:newsticker.text>
<jwplayer:captions.file>captionsccc.xml</jwplayer:captions.file>
</track>
<track>
<creator>The Peach Open Movie Project</creator>
<title>4: Big Buck Bunny - PNG Image with start</title>
<info>http://www.bigbuckbunny.org/</info>
<annotation>Big Buck Bunny is a short animated film by the Blender Institute, part of the Blender Foundation. Like the foundation's previous film Elephants Dream, the film is made using free and open source software.</annotation>
<location>http://www.longtailvideo.com/jw/upload/bunny.png</location>
<image>http://www.longtailvideo.com/jw/upload/bunny.jpg</image>
<meta rel="duration">20</meta>
<meta rel="start">10</meta>
<jwplayer:newsticker.link>http://www.yahoo.com/</jwplayer:newsticker.link>
<jwplayer:newsticker.text>THIS IS THE 4th VIDEO</jwplayer:newsticker.text>
<jwplayer:captions.file>captionsddd.xml</jwplayer:captions.file>
</track>
</trackList>
</playlist>

JW Player

User  
0 rated :

Sorry, I was looking at the links below the player, not the built-in playlist.

Yes, your test works for me.

I see that you are using a player with a micro version of 1397. I need to use a licensed/released version and so I believe I'm stuck with 5.3.1356. Maybe this is a question now for Ethan or someone. Do I need to wait for version 5.4 to get a licensed/released version of the player with changes such as these incorporated?

JW Player

User  
0 rated :

i changed the Test Page to v5.3.1356; the error still pops...

This question has received the maximum number of answers.