Hello I wish not to disturb but I’m newer to developing program.
I’m trying to make a video playing in an activity but I get always black screen.
My video is in mp4 h264 created with ffmpeg with android profile and plays in quicktime and is set in res/raw/corsolex_1.mp4
I attach the code I’m writing to understand what I miss to do, if someone can help I’m very grateful.
Angelo
this activity is called Clipvideo1
package com.wocmultimedia.VideoEditLesson1;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
public class Clipvideo1 extends Activity {@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.clip1);
// Put the media file into the res/raw folder of your application
MediaPlayer mp = MediaPlayer.create(this, R.raw.corsolex_1);
mp.start();
}}
this is the XML layout called clip1.xml
<FrameLayout android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<VideoView android:id="@+id/videoView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></VideoView>
</FrameLayout>
You don’t link the video to VideoView somehow.
So as you see you have 3 parts of the uri:
“corsolex_1” is the name of your video
Maybe this code helps: