Our first book, Android Wireless Application Development, is now in stock and available for purchase.
Thursday, September 3, 2009
Subscribe to:
Post Comments (Atom)
A comprehensive guide for designing, developing, debugging, and distributing Android applications.
2 comments:
This is useful for getting a Resource file but is there a way to get to assets ... or do you know the path to assets once it is on your phone?
this is my code and some errors....
the error is
1)02-21 15:09:18.992: E/MediaPlayer(482): error (1, -2147483648)
02-21 15:09:19.487: E/MediaPlayer(482): Error (1,-2147483648)
02-21 15:09:19.518: D/VideoView(482): Error: 1,-2147483648
2)02-21 16:30:06.227: D/MediaPlayer(786): Couldn't open file on client side, trying server side
3)Cannot play video :Sorry,this video cannot be played.
package com.example.android.apis.media;
import android.app.Activity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
public class VideoViewDemo extends Activity {
/**
* TODO: Set the path variable to a streaming video URL or a local media
* file path.
*/
private String path = "http://commonsware.com/misc/test2.3gp";
private VideoView mVideoView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
mVideoView = (VideoView) findViewById(R.id.surface_view);
if (path == "") {
// Tell the user to provide a media file URL/path.
Toast.makeText(
VideoViewDemo.this,
"Please edit VideoViewDemo Activity, and set path"
+ " variable to your media file URL/path",
Toast.LENGTH_LONG).show();
} else {
/*
* Alternatively,for streaming media you can use
* mVideoView.setVideoURI(Uri.parse(URLstring));
*/
mVideoView.setVideoPath(path);
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
}
}
}
Post a Comment