VideoView on Archos 5 (Android 1.6) doesn't work - android

I'm developing an app for the Archos 5 Internet Tablet. (With Android 1.6)
I want to start a video in a VideoView within my app. On my Android emulator the following code works fine but on my Archos 5 I always get an error:
Cannot play video
Sorry, this video cannot be played.
//get current window information, and set format, set it up differently, if you need some special effects
getWindow().setFormat(PixelFormat.TRANSLUCENT);
//the VideoView will hold the video
VideoView videoHolder = (VideoView) findViewById(R.id.VideoView01);
//MediaController is the ui control hovering above the video (just like in the default youtube player).
videoHolder.setMediaController(new MediaController(this));
//assing a video file to the video holder
videoHolder.setVideoURI(Uri.parse("android.resource://mypackage/" + R.raw.testmovie));
//get focus, before playing the video.
videoHolder.requestFocus();
if(autoplay){
videoHolder.start();
}
Is there a way to run a VideoView on a archos 5?
I also tried to play the movie with the archos player. With the following code I get the error: "Cannot find the media file!".
String ACTION_LAUNCH_AVOS = "android.intent.action.LAUNCH_AVOS";
String avosCommand = "ACTION:video_play,url=videoentries:Video/testmovie.wmv,etype=resume";
final Intent startAvos = new Intent(ACTION_LAUNCH_AVOS,Uri.parse(avosCommand));
startAvos.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
startActivity(startAvos);
I put the video in the Video folder of the Archos. The video runs when I open it with the file browser.
I always get the error "Cannot find the media file!", no matter what url I use.
Is there a certain folder where I have to put the video so that it can be found? And how do I get the url to that certain folder?
It would be great if you could help me!
Thanks and BR,
Thomas

Related

Play a video on Android using a videoview container

Im trying to understand how to add video to my application using the VideoView container but so far I've never been able to view a video and all i receive is an error 'Can't play this video'.
I have a simple method that load's the video:-
private void setupVideo() {
VideoView videoView = (VideoView)findViewById(R.id.videoView);
videoView.setVideoPath("video/Test_Movie.m4v");
videoView.start();
}
I have tried converting the video to many H264, H263 , 3gp formats but I can find anything that works.I even have downloaded a video that said worked in a book i have but still doesn't work.
any help appreciated!
thx.

android videoview error 1, -2147483648

I am getting error while playing video from asset folder and raw folder.
MediaPlayer error (1, -2147483648)
VideoView error 1, -2147483648.
I tried from asset folder as.
private String SrcPath = "file:///android_asset/aaa.mp4"; //also tried aaaa.mp3
VideoView vv = (VideoView)findViewById(R.id.videoView1);
vv.setVideoPath(SrcPath);
MediaController controller = new MediaController(this);
controller.setAnchorView(vv);
vv.setMediaController(controller);
vv.requestFocus();
vv.start();
and for raw folder i used URI as :
Uri video = Uri.parse("android.resource://com.usecontentprovider/raw/aaa.mp4");
vv.setVideoURI(video);
I got the same error message in both cases.
You can use software like avinaptic2 to get the video encoding information and make sure it matches the supported media formats in android.
A common problem I find is that videos are encoded with the wrong profiling. H.264 videos need to be encoded with Baseline level 3 or under to be played without errors or artifacts in Android.
I found the solution as I am able to play video on virtual device.
I replaced the line
Uri video = Uri.parse("android.resource://com.usecontentprovider/raw/aaa.mp4");
with
Uri video = Uri.parse("android.resource://com.usecontentprovider/raw/"+R.raw.aaa);
And its working
Using R.raw works fine but in some cases I still get the same error. Fortunately I found the solution to my problem: I had to call videoView.start() inside onPrepare().
You can check the correct answer here:
Android: 'Can't play this video'; MediaPlayer & VideoView Error 1 -38

Video not playing from sd card in motorola 2.3.3

i am developing an application in that i need to play video from sd card. i am using the following code and its working fine in all devices except motorola 2.3.3 device.
some times its playing 10-15 seconds video then black screen came , but some times it shows only black screen and it shows time duration in the bottom of the video view.
so, please guide me.. thankyou
VideoView vv = (VideoView) this.findViewById(R.id.video_view);
String filepath = "mnt/sdcard/my_video.mp4";
MediaController mc = new MediaController(this);
mc.setAnchorView(vv);
vv.setMediaController(mc);
vv.requestFocus();
vv.start();
if(play the same video using default player in gallery){
//you are doing something wrong in ur code
}else{
//this device has no capabilities to play the provided video with the default codes.
//try to look for any installed app that can play the video for this devices
}

Android SDK - Media Player Video from URL

I've tried to find a simple tutorial which explains how to load a video from a URL into the android media player but unfortunately I couldn't find any!
I have tried several things to try get it working but still no luck.
What is the best way to have a MediaPlayerActivity just load a video from a URL?
Thanks
EDIT:
I have tried the following code as suggested:
VideoView videoView = (VideoView) findViewById(R.id.your_video_view);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setVideoURI(Uri.parse("url-here"));
videoView.start();
It just crashes when I go to this activity.
You can use a VideoView. Here is an example:
VideoView videoView = (VideoView) findViewById(R.id.videoView);
//Use a media controller so that you can scroll the video contents
//and also to pause, start the video.
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setVideoURI(Uri.parse(videoUrl));
videoView.start();
EDIT
You should provide the URI (having a String url variable, where it has the url of the video) with this code Uri.parse(url). And also be sure if the url is appropriate. Also, have you provided the appropriate permissions to your app, as AkashG suggested, (since it uses the internet you will need to add <uses-permission android:name="android.permission.INTERNET" > in your app's Manifest.xml)? Finally you should define your activity MediaPlayerActivity in in your app's Manifest.xml
End of EDIT
You can also use MediaPlayer. The Android developers site has a good tutorial here.
you can load video from url as:
VideoView videoView = (VideoView) findViewById(R.id.view);
MediaController controller = new MediaController(this);
videoView.setVideoPath("url of the video");
videoView.setMediaController(controller);
videoView.start();
Add internet permission in manifest file.
I think you can find useful thinks Here.. about playing video from different sources.
If your using Emulator ,
First, do not use the emulator for testing video playback. Its ability to handle video playback is very limited. Use an actual Android device.
Second, always check LogCat (adb logcat, DDMS, or DDMS perspective in Eclipse) for warnings when you run into multimedia problems. OpenCORE -- the multimedia engine used by Android -- has a tendency to log error-level conditions as warnings.
For example, your video file may not be set up for progressive download, which is required for HTTP streaming. On Linux, you can patch up MP4 videos for progressive download by installing MP4Box and running MP4Box -hint .
Hope this explanation works for you..

Issue on Android Video View its not working

I'm playing YouTube from URL, but when I play the video it shows the following error:
unable to open video
I'm using this code:
video =new VideoView(this);
video.setVideoURI(path);
System.out.println("my path"+path);
ctlr = new MediaController(this);
ctlr.setMediaPlayer(video);
video.setMediaController(ctlr);
video.requestFocus();`
The path is correct. I checked on the Web also. Why am I getting an error like that?
The links are like: http://www.youtube.com/v/8B-Vu94Sd4M?f=videos&app=youtube_gdata
You can't simply give the VideoView a Youtube URL and expect it to play the video. This seams to be impossible at all (see here).
However, you might want to use a YouTube Intent and let the System handle it: Link

Categories

Resources