Issue Using VideoView in Android -
i'm having similar issue.i'm newly working genymotion , android studio , trying implement video view showing errors e/mediaplayer: error (1,-2147483648) , w/egl_genymotion: eglsurfaceattrib not implemented
the code share bellow working in eclips not android studio here 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 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 displays 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 location of media file uri uri = uri.parse("android.resource://" + getpackagename() + "/" + r.raw.videoplay); //setting mediacontroller , uri, starting 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; }
Comments
Post a Comment