0

I'm having the similar issue.I'm newly working with genymotion and Android Studio and trying to implement Video View but it is showing errors like E/MediaPlayer: Error (1,-2147483648) And W/EGL_genymotion: eglSurfaceAttrib not implemented

The Code I will Share Bellow is working in Eclips but not with Android studio here is the xml File

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#fff" >

        <VideoView  
            android:id="@+id/video_view"  
            android:layout_width="fill_parent"  
            android:layout_height="fill_parent"  
            /> 

    </RelativeLayout>

And The Java Code is

    import android.app.Activity;
    import android.content.Intent;
    import android.net.Uri;
    import android.os.Bundle;
    import android.view.KeyEvent;
    import android.view.Window;
    import android.view.WindowManager;
    import android.widget.MediaController;
    import android.widget.VideoView;

    public class VideoPlayerActivity extends Activity{
        VideoView videoView;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.activity_video_player);
            videoView = (VideoView) findViewById(R.id.video_view);


            //code that displays the content in full screen mode  
            this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);

            //Creating MediaController  
            MediaController mediaController= new MediaController(this);  
            mediaController.setAnchorView(videoView);


            //specify the location of media file
            Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.videoplay);
            //Setting MediaController and URI, then starting the videoView  
            videoView.setMediaController(mediaController);  
            videoView.setVideoURI(uri);          
            videoView.requestFocus();
            videoView.setVideoPath("/sdcard/blonde_secretary.3gp");
            videoView.start();
        }

        @Override
        public boolean onKeyDown(int keyCode, KeyEvent event) 
        {
            if(keyCode == KeyEvent.KEYCODE_BACK)
            {
                Intent intent =  new Intent(VideoPlayerActivity.this , MainActivity.class);
                startActivity(intent);
            }
            return false;
        }
Ritesh
  • 876
  • 9
  • 14
  • calling setVideoPath() will override the URI you pass to setVideoURI() won't it? – brindy Jan 15 '16 at 23:33
  • I think your video is not supported by Android, try using mp4 video. Check this link http://stackoverflow.com/questions/3263736/playing-a-video-in-videoview-in-android – Anuj Sharma Jan 19 '16 at 04:35

0 Answers0