Reputation: 63
When I try play video from specific URL at my API-27 emulator Android show me message dialog
Can't play this video
That's it what I get in Logcat
source returned error -1010, 0 retries left
initFromDataSource, source has no track!
Failed to init from data source!
MediaPlayerNative: error (1, -2147483648)
MediaPlayer: Error (1,-2147483648)
mVideoView = findViewById(R.id.videoView);
mMediaController = new MediaController(this);
mVideoView.setVideoPath("https://clips.vorwaerts-gmbh.de/VfE_html5.mp4");
mVideoView.requestFocus();
initListeners();
initListeners method
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mVideoView.setMediaController(mMediaController);
mVideoView.setBackground(null);
mMediaController.setAnchorView(mVideoView);
mMediaController.show();
mVideoView.start();
}
});
mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mVideoView.setBackground(getDrawable(R.drawable.webinar_photo_preview));
}
});
I test my videoview feature at api23, api24 and everything sounds good. Can somebody tell me what I'm doing wrong?
EDITED: Now I found that the error also appears on api24
Upvotes: 3
Views: 1582
Reputation: 63
Problem was in VideoView, setVideoPath set videos only with little file size (1 - 2 MB) and if it size is bigger MediaPlayer crashes with MEDIA_ERROR_SYSTEM (-2147483648)
- (low-level system error), read in documentation . That why I start using exoPlayer.
Upvotes: 3
Reputation: 164
Its look like your code is working fine and maybe the problem is that you are not using cookies that are send to browser at the time of request.
In simple terms this video is not for direct access via code.
If you still wants to try the steps below.
Note - If you want to use cookies to play video it can be done via ExoPlayer(https://github.com/google/ExoPlayer).
Upvotes: 0