这是我在活动中的onCreate
/** Called when the activity is first created. */@OverrIDepublic voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);this.setContentVIEw(R.layout.vIDeo_test); SurfaceVIEw v = (SurfaceVIEw) findVIEwByID(R.ID.surface_vIDeo); SurfaceHolder holder = v.getHolder(); // Set the transparency //getwindow().setFormat(PixelFormat.UNKNowN); // Set a size for the vIDeo screen //holder.addCallback(this); holder.setFixedSize(400,300); MediaPlayer mp = MediaPlayer.create(this,R.raw.fiat); mp.setdisplay(holder); //mp.setAudioStreamType(2); try { //mp.prepare(); mp.start(); } catch (IllegalStateException e) { // Todo auto-generated catch block e.printstacktrace(); }
她是vIDeo_test.xml中的布局
<?xml version="1.0" enCoding="utf-8"?> <linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:orIEntation="vertical" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" > <SurfaceVIEw androID:ID="@+ID/surface_vIDeo" androID:layout_wIDth="250px" androID:layout_height="250px"> </SurfaceVIEw> <linearLayout androID:orIEntation="horizontal" androID:layout_height="wrap_content" androID:layout_wIDth="fill_parent" androID:padding="10dip" > </linearLayout> </linearLayout>
>大段引用
解决方法 如果您使用的是模拟器,则可能无效.模拟器缺少AndroID设备中可用的硬件加速.例如,在2.6GHz Core 2 Duo上,我有时可以播放视频,但并非总是如此.在较慢的机器上,视频播放永远不会奏效在2.5GHz Core 2 Quad上,我总是可以播放视频.话虽这么说,我通常会在实际设备上测试视频播放.我也不确定视频播放是否来自原始资源.我强烈建议您先尝试使用SD卡上的文件中的视频.
对于绝对有效的视频,我知道here的“纪录片和你”以及“我们的孙子们的音乐”都是以他们的MP4形式工作的.
总结以上是内存溢出为你收集整理的安卓视频,听到声音,但没有视频全部内容,希望文章能够帮你解决安卓视频,听到声音,但没有视频所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)