Note that there are some explanatory texts on larger screens.

plurals
  1. POMediaPlayer / VideoView not playing video?
    primarykey
    data
    text
    <p>I'm new to android development, self taught so can expect a few errors here and there but none so irritating as this. I've looked over my code a thousand times, searched high and low across multiple websites, books and forums for an answer but I still get the same error so this is a last resort.</p> <p>I just want to play a hardcoded path to a video in an activity, which is part of my video portfolio app. (The hardcoded path is just for testing, later I will call each video from the related button press, but only after I sort the player out!).</p> <p>Here is my code:</p> <pre><code>String path = "android.resource://mysite/res/raw/video1"; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_videoplayer); VideoView view = (VideoView) this.findViewById(R.id.vv); MediaController controller = (MediaController) new MediaController(this); controller.setMediaPlayer(view); view.setVideoPath(path); view.requestFocus(); view.start(); } </code></pre> <p>This snippet is inside my VideoPlayer class, where vv is the VideoView in the XML and video1 is the video to be played. The video is h.264 mp4, 1 minute long and 3mb in size and can be played normally through the default player.</p> <p>XML:</p> <pre><code>&lt;VideoView android:id="@+id/vv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /&gt; </code></pre> <p>The activity loads but returns the error "Can't play this video".</p> <p>Any help I greatly appreciate.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload