Playing a video in VideoView in Android

android

Solution

My guess is that your video is incompatible with Android. Try it with a different video. This one definitely works used to work with Android (but does not on newer devices, for some reason). If that video works, and yours does not, then your video is not compatible with Android.

As others have indicated, please test this on a device. Video playback on the emulator requires too much power.

UPDATE 2020-02-18: https://law.duke.edu/cspd/contest/videos/Framed-Contest_Documentaries-and-You.mp4 is an MP4 of the same content, but I have no idea if it is the same actual MP4 as I previously linked to.

Problem

I can't figure out why I'm not able to play the video in my VideoView. All I'm getting for a message is: Cannot Play Video : Sorry, this video cannot be played. I created an SD card for my emulator as well. Do I need to place my SD card in a particular folder in my SDK? Please comment. Here's the layout: ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/LinearLayout01" android:layout_height="fill_parent" android:paddingLeft="2px" android:paddingRight="2px" xmlns:android="http://schemas.android.com/apk/res/android" android:paddingTop="2px" android:paddingBottom="2px" android:layout_width="fill_parent" android:orientation="vertical"> <VideoView android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/VideoView" /> </LinearLayout> ``` Here's the code: ``` package com.examples.videoviewdemo; import android.app.Activity; import android.os.Bundle; import android.widget.MediaController; import android.widget.VideoView; public class VideoViewDemo extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); VideoView videoView = (VideoView)findViewById(R.id.VideoView); //MediaController mediaController = new MediaController(this); // mediaController.setAnchorView(videoView); //videoView.setMediaController(mediaController); videoView.setVideoPath("/sdcard/blonde_secretary.3gp"); videoView.start(); } } ``` Waiting for the reply...

Original source

Related problems