Can a videoview play a video stored on internal storage?

MediaPlayer requires that the file being played has world-readable permissions. You can view the permissions of the file with the following command in adb shell: ls -al /data/data/com.mypackage/myfile You will probably see “-rw——“, which means that only the owner (your app, not MediaPlayer) has read/write permissions. Note: Your phone must be rooted in order to … Read more

Android MediaPlayer/VideoView error (1, -2147483648)

As it turns out, error -2147483648 indicates an unknown error. This could have something to do with the video encoding, but it’s also worth checking that the file path exists and that the VideoView has permission to read it. My issue was that I was writing my files with Context.MODE_PRIVATE (the default). openFileOutput(filename, Context.MODE_PRIVATE); This … Read more

how to play video from url

It has something to do with your link and content. Try the following two links: String path=”http://www.ted.com/talks/download/video/8584/talk/761″; String path1=”http://commonsware.com/misc/test2.3gp”; Uri uri=Uri.parse(path1); VideoView video=(VideoView)findViewById(R.id.VideoView01); video.setVideoURI(uri); video.start(); Start with “path1”, it is a small light weight video stream and then try the “path”, it is a higher resolution than “path1”, a perfect high resolution for the mobile … Read more

Android VideoView black screen

I meet the same problem, and solve it with the accepted solution above plus this: @Override public void onPrepared(MediaPlayer mp) { mp.setOnInfoListener(new MediaPlayer.OnInfoListener() { @Override public boolean onInfo(MediaPlayer mp, int what, int extra) { Log.d(TAG, “onInfo, what = ” + what); if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { // video started; hide the placeholder. placeholder.setVisibility(View.GONE); return true; … Read more

VideoView getDrawingCache is returning black

From the docs for View#setDrawingCacheEnabled: Enabling the drawing cache is similar to setting a layer when hardware acceleration is turned off. When hardware acceleration is turned on, enabling the drawing cache has no effect on rendering because the system uses a different mechanism for acceleration which ignores the flag. If you want to use a … Read more

VideoView to match parent height and keep aspect ratio

You should extends from the built-in video view. Call setVideoSize before video view is shown, you can get video size from thumbnail extracted from video. So that, when video view’s onMeasure is called, both mVideoWidth & mVideoHeight are > 0. If you want to account the height of controllers, you can do it yourself in … Read more

Full screen videoview without stretching the video

Like this you can set the properties of the video by yourself. Use a SurfaceView (gives you more control on the view), set it to fill_parent to match the whole screen <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”fill_parent”> <SurfaceView android:id=”@+id/surfaceViewFrame” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:layout_gravity=”center” > </SurfaceView> </Linearlayout> then on your java code get the surface view and add … Read more