I am working on an application in which I have to use Android Video Player. I give this a Player URI that once starts up, and for some time does not. A URI is generated at runtime according to a specific procedure.
I get the following error in logcat when the video is not playing.
03-30 12:58:42.918: D/MediaPlayer(4948): Couldn't open file on client side, trying server side 03-30 12:58:43.516: E/MediaPlayer(4948): error (1, -1004) 03-30 12:58:43.516: E/MediaPlayer(4948): Error (1,-1004) 03-30 12:58:43.520: D/VideoView(4948): Error: 1,-1004
I can not understand this error. Please if anyone can explain this to me. This is a problem on my (VideoPlayer) end or on the server.
The code for use as a video player is as follows:
String url = getIntent().getExtras().getString("videourl"); VideoView videoView = (VideoView) findViewById(R.id.videoview); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); Uri video = Uri.parse(url); videoView.setMediaController(mediaController); videoView.setVideoURI(video); videoView.start();
Another thing is that when the video does not play, the Error dialog box appears, which shows:
"Sorry, this video cannot be played" with the ok button. When I click the button, the view does not return to the previous application window, rather, it remains on the VideoPlayer screen, and I have to press the back button twice to return to the previous view. Why is that so .. ??? Any help regarding the issues explained is greatly appreciated.
source share