Hi all
I've run into a small problem with an app I am working on...
The problem is that I want to show a video inside an activity. I can get the video to play from the res/raw folder and it runs smoothly. But there are some minor problems...
First of all, there is no thumbnail for the video, the place in which the video is shown is just a big black area until I press it - then the media controls appear and as I press play, the video starts and the image is shown, also when paused...
The next problem is that the controls that appear when I interact with the video are shown in the absolute bottom of the app. I would really like them to be shown as an overlay on the VideoView or just below the video...
And the last minor problem is that the video is not there at wall when I place it in a LinearLayout inside a ScrollView (to scroll both the video and the text before and after).
My layout looks like this, in the case where the video almost works (wrapping it all in the scroll view when the video is not shown at all):
And the code where the video is initialized in onCreate:
I've run into a small problem with an app I am working on...
The problem is that I want to show a video inside an activity. I can get the video to play from the res/raw folder and it runs smoothly. But there are some minor problems...
First of all, there is no thumbnail for the video, the place in which the video is shown is just a big black area until I press it - then the media controls appear and as I press play, the video starts and the image is shown, also when paused...
The next problem is that the controls that appear when I interact with the video are shown in the absolute bottom of the app. I would really like them to be shown as an overlay on the VideoView or just below the video...
And the last minor problem is that the video is not there at wall when I place it in a LinearLayout inside a ScrollView (to scroll both the video and the text before and after).
My layout looks like this, in the case where the video almost works (wrapping it all in the scroll view when the video is not shown at all):
Code:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/step_pres_intro"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="14dip"
/>
<VideoView
android:id="@+id/step_pres_video"
android:layout_width="wrap_content"
android:layout_height="150dip"
android:gravity="center"
android:layout_gravity="center"
/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbarStyle="outsideOverlay"
android:padding="10dip"
>
<TextView
android:id="@+id/step_pres_more_info"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="14dip"
/>
</ScrollView>
</LinearLayout>
And the code where the video is initialized in onCreate:
Code:
//Presentation - video
stepPresVideo = (VideoView) findViewById(R.id.step_pres_video);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(stepPresVideo);
Uri videoPath = Uri.parse("android.resource://jamtheman.dk.app.skridt/raw/vejskilte");
System.out.println("PRESENTATION --- Video Path to Load -- " + videoPath);
stepPresVideo.setMediaController(mediaController);
stepPresVideo.setVideoURI(videoPath);
stepPresVideo.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
mp.pause();
}
});