First time working with video on Android.. All code samples I have tried to use render a "can't play this video" message.
Here is one implementation I have been trying:
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Uri.parse("http://www.boisestatefootball.com/sites/default/files/videos/original/01%20-%20coach%20pete%20bio_4.mp4");
VideoView mVideoView = (VideoView)findViewById(R.id.VideoView);
mVideoView.setMediaController(new MediaController(this));
mVideoView.setVideoURI(uri);
mVideoView.requestFocus();
mVideoView.start();
}
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.example.moviedemo.MainActivity" >
<VideoView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/VideoView" />
</RelativeLayout>
I also tried this one: Streaming video with videoview
and a couple other solutions like those here: How to play a video file in android?
but the result is the same each time. I also tried putting the video from this post: Playing a video in VideoView in Android into my assets folder and loading it from there, but I got the same message. (EDIT: This video file isn't compatible with new Androids, but the one in the URI definitely is)
The two videos I've been testing with have both come from sample android code, so I know it can't be a formatting issue. Is there something else that is needed to get a video playing?