开源 android md 播放器,MD360Player4Android
OpenGLES 2.0 required
Android 4.0.3 (IceCreamSandwich API-15) required
There are two way to use this library depend on your requirement,
根據你的需要,該庫有兩種使用方法。
使用MDGLSurfaceView
第一步 在layout xml中定義com.asha.vrlib.MDGLSurfaceView...
android:id="@+id/md_surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent"?/>
...
第二步 當surface準備好了之后,把android.view.Surface設置到MediaPlayer上public?class?MDGLSurfaceViewDemoActivity?extends?MediaPlayerActivity?{
@Override
public?void?onCreate(Bundle?savedInstanceState)?{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_md_gl_surface);
MDGLSurfaceView?mGLSurfaceView?=?(MDGLSurfaceView)?findViewById(R.id.md_surface_view);
mGLSurfaceView.init(new?MD360Renderer.IOnSurfaceReadyListener()?{
@Override
public?void?onSurfaceReady(Surface?surface)?{
//MediaPlayer?or?something?else.
getPlayer().setSurface(surface);
}
});
}
}
更靈活的方式: MD360Renderer
第一步 建立一個MD360Renderer并設置android.view.Surface。public?class?MD360RenderDemoActivity?extends?MediaPlayerActivity?{
private?MD360Renderer?mRenderer;
@Override
public?void?onCreate(Bundle?savedInstanceState)?{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_md_render);
mRenderer?=?MD360Renderer.with(this)
.listenSurfaceReady(new?MD360Renderer.IOnSurfaceReadyListener()?{
@Override
public?void?onSurfaceReady(Surface?surface)?{
getPlayer().setSurface(surface);
}
})
.build();
//?init?OpenGL
initOpenGL(R.id.surface_view);
}
}
第二步 自己初始化OpenGL,并把MD360Renderer設置到你的android.opengl.GLSurfaceView上。private?void?initOpenGL(int?glSurfaceViewResId)?{
mGLSurfaceView?=?(GLSurfaceView)?findViewById(glSurfaceViewResId);
if?(GLUtil.supportsEs2(this))?{
//?Request?an?OpenGL?ES?2.0?compatible?context.
mGLSurfaceView.setEGLContextClientVersion(2);
//?Set?the?renderer?to?our?demo?renderer,?defined?below.
mGLSurfaceView.setRenderer(mRenderer);
}?else?{
mGLSurfaceView.setVisibility(View.GONE);
Toast.makeText(MD360RenderDemoActivity.this,?"OpenGLES2?not?supported.",?Toast.LENGTH_SHORT).show();
}
}
Reference
總結
以上是生活随笔為你收集整理的开源 android md 播放器,MD360Player4Android的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 电子器件系列四:锁相环
- 下一篇: 搭建双极性晶体管直流特性测试实验需要哪些