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

jwplayer for android, how to catch error


Hi,

I am using jwplayer sdk for android with the latest library:

compile 'com.longtailvideo.jwplayer:jwplayer-core:2.7.9+31'
compile 'com.longtailvideo.jwplayer:jwplayer-common:2.7.9+31'

I would like to handle when error occurs, so I implement either OnErrorListener or OnErrorListenerV2, however either playable or unplayable media url, the onError() always fires with the same error message "Invalid HTTP response code: 404: Not Found". Am I doing wrong or there is another way to catch unplayable event? Thanks.

8 Community Answers

George

JW Player Support Agent  
0 rated :

OnError is firing with a seemingly correct message. What exactly were you expecting?

Binh Nguyen

User  
0 rated :

With broken media file url:
-> jwplayer cannot play -> onError() -> "Invalid HTTP response code: 404: Not Found" -> is okay

With playable media file url:
-> jwplayer play properly -> onError() -> "Invalid HTTP response code: 404: Not Found" -> is not okay

What I am expecting is: onError() shouldn't fire if the media file is playable. I am showing error message in onError(), that causes error message is displayed either with playable or unplayable media.

George

JW Player Support Agent  
0 rated :

Hello Binh,

What is the video URL that is playable but throws a 404?

Binh Nguyen

User  
0 rated :

Hi George,

It seems I found the root cause, whenever I disable jw vr library, the onError() method works as expected.

// compile(name: 'base', ext: 'aar')
// compile(name: 'common', ext: 'aar')
// compile(name: 'jwplayer-vr-sdk-1.0.0+12', ext: 'aar')

I could send a sample project if you cannot produce there, please share your email.

I summarize steps to reproduce the issue:
1. copies base, common and jwplayer vr sdk into lib folder
2. add jwplayer and jw vr into gradle
// JW VR PLAYER
compile(name: 'base', ext: 'aar')
compile(name: 'common', ext: 'aar')
compile(name: 'jwplayer-vr-sdk-1.0.0+12', ext: 'aar')

// JW PLAYER
compile 'com.longtailvideo.jwplayer:jwplayer-core:2.7.9+31'
compile 'com.longtailvideo.jwplayer:jwplayer-common:2.7.9+31'
3. Implement onError listener
mPlayerView.addOnErrorListener(new VideoPlayerEvents.OnErrorListenerV2() {
@Override
public void onError(ErrorEvent errorEvent) {
System.out.println("errorEvent " + errorEvent);
finish();
}
});
4. Play any media such http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8

Current result: onError() fires
Expected result: onError() shouldn't fire

Binh Nguyen

User  
0 rated :

Please note that I need to use both jwplayer and jwplayer vr in my project

George

JW Player Support Agent  
0 rated :

Hello Binh,

Please reproduce the issue in our demo application and send me a link to a zip file containing the source code.
https://github.com/jwplayer/jwplayer-sdk-android-demo

You may omit your license key

Binh Nguyen

User  
0 rated :

Hi George,

https://www.dropbox.com/s/ngf79jr0moslkyh/jwplayer-sdk-android-demo-master%20copy.zip?dl=0

Hyunjoo Kim

JW Player Support Agent  
1 rated :

Hi Binh,

I was able to reproduce the issue and have escalated the bug report to engineering.

This question has received the maximum number of answers.