Please try it and let me know if you have any issue.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView videoView = (VideoView)findViewById(R.id.VideoView);
videoView.setKeepScreenOn(true);
videoView.setVideoPath("/sdcard/blonde_secretary.3gp");
videoView.start();
videoView.requestFocus();
}
- Anurag Singh
On Fri, Jul 16, 2010 at 5:54 PM, Maxood <[email protected]> wrote:
> I can't figure out why am i not able to play the video in my
> VideoView. All i'm getting 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 me SD
> card in a particular folder in my SDK? Please comment.
>
> Here's the code:
>
>
> <?xml version="1.0" encoding="utf-8"?>
>
>
>
> <LinearLayout android:id="@+id/LinearLayout01"
>
> android:layout_height="fill_parent" xmlns:android="http://
> schemas.android.com/apk/res/android"
>
> android:paddingLeft="2px" android:paddingRight="2px"
>
> 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"></VideoView>
>
>
>
> </LinearLayout>
>
>
>
> 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();
>
>
>
>
> }
> }
>
>
>
> These are the error messages displayed in my Log cat window: 07-16
> 17:16:30.237: ERROR/PlayerDriver(30): Command PLAYER_SET_DATA_SOURCE
> completed with an error or info PVMFErrNotSupported 07-16
> 17:16:30.247: ERROR/MediaPlayer(240): error (1, -4) 07-16
> 17:16:30.257: ERROR/MediaPlayer(240): Error (1,-4) 07-16 17:16:30.267:
> DEBUG/VideoView(240): Error: 1,-4 07-16 17:16:30.287: WARN/
> PlayerDriver(30): PVMFInfoErrorHandlingComplete
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en