I want to create a media player to stream video from resource, which is normally available only from web browser and hence isn't too convenient for mobile. I've little experience in Android development and therefore first issue has puzzled me. So, what I've done:
- Added
<uses-permission android:name="android.permission.INTERNET" />
to the manifest - Created a VideoView in my only activity
- Ran following code:
VideoView videoView = (VideoView)findViewById(R.id.videoView);
MediaController mediaController= new MediaController(this);
mediaController.setAnchorView(videoView);
Uri uri = Uri.parse("http://home/video.mp4");
videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();
when I run it in the Android emulator on videoView.setVideoURI(uri)
I'm getting an error:
java.io.FileNotFoundException: No content provider: http://home/video.mp4 At the same time same URL opens in Chrome browser in same emulator without issues.
I've digged a little and found out the error occurs in MediaPlayer.attemptDataSource because it uses default ContentResolver, which accepts only "content://" scheme.
I couldn't find any mention of setting content resolver when creating a media player on the web. Do I need to do it differently?