# MD360Player4Android
It is a lite library to render 360 degree panorama video for Android.
[![](https://jitpack.io/v/ashqal/MD360Player4Android.svg)](https://jitpack.io/#ashqal/MD360Player4Android)
## Preview
![ScreenShot](https://github.com/ashqal/MD360Player4Android/raw/master/app/demo/preview.jpg)
![ScreenShot](https://github.com/ashqal/MD360Player4Android/raw/master/app/demo/preview1.jpg)
![ScreenShot](https://github.com/ashqal/MD360Player4Android/raw/master/app/demo/preview2.jpg)
## NOTICE
* OpenGLES 2.0 required
* Android 4.0.3 (Ice Cream Sandwich API-15) required
* Compatible with all Players which have `setSurface` api.
* This library do nothing but render the image of video frame, so you may deal with the issues about `MediaPlayer` or `IjkMediaPlayer` (e.g. play local file, rtmp, hls) by yourself;
* 这个库只负责视频帧画面的渲染,所有的视频文件播放、控制的工作都交给了`MediaPlayer`或者`IjkMediaPlayer`,你可能需要自己处理使用Player过程中出现的问题(比如播放本地文件、rtmp、hls).
## Last Commit
**`-SNAPSHOT`**
## Release Note
**2.0.1.beta**
* bug fix.
* add anti-distortion support.
```java
// init configuation
protected MDVRLibrary createVRLibrary() {
return MDVRLibrary.with(this)
...
.barrelDistortionConfig(new BarrelDistortionConfig().setDefaultEnabled(true).setScale(0.95f))
.build(R.id.gl_view);
}
```
```java
// setter
mVRLibrary.setAntiDistortionEnabled(true);
```
* hotspot support.
```java
// add hotspot dynamicly.
findViewById(R.id.button_add_plugin_logo).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
private MDPosition logoPosition = MDPosition.newInstance().setY(-8.0f).setYaw(-90.0f);
MDSimplePlugin plugin = MDSimplePlugin.builder()
.size(4f,4f)
.provider(new MDVRLibrary.IBitmapProvider() {
@Override
public void onProvideBitmap(MD360BitmapTexture.Callback callback) {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.moredoo_logo);
callback.texture(bitmap);
}
})
.title("logo")
.position(logoPosition)
.listenClick(new MDVRLibrary.IPickListener() {
@Override
public void onHotspotHit(IMDHotspot hotspot, long hitTimestamp) {
Toast.makeText(MD360PlayerActivity.this, "click logo", Toast.LENGTH_SHORT).show();
}
})
.build();
plugins.add(plugin);
getVRLibrary().addPlugin(plugin);
Toast.makeText(MD360PlayerActivity.this, "add plugin logo" , Toast.LENGTH_SHORT).show();
}
});
```
* eye picker
```java
// setEyePickChangedListener dynamicly.
final TextView hotspotText = (TextView) findViewById(R.id.hotspot_text);
getVRLibrary().setEyePickChangedListener(new MDVRLibrary.IPickListener() {
@Override
public void onHotspotHit(IMDHotspot hotspot, long hitTimestamp) {
String text = hotspot == null ? "nop" : String.format(Locale.CHINESE, "%s %fs", hotspot.getTitle(), (System.currentTimeMillis() - hitTimestamp) / 1000.0f );
hotspotText.setText(text);
}
});
```
```java
// disable the eye picker
getVRLibrary().eyePickEanbled(false);
```
**1.5.3**
* Keep the GLContext instance onPause.
* GLTextureView supported!
**1.5.0**
* make the switch mode public. `switchInteractiveMode(Activity activity, int mode)` , `switchDisplayMode(Activity activity, int mode)` and `switchProjectionMode(Activity activity, int mode)`.
* add dome support.
* add stereo support.
* add plane support.
* switch projection in runtime support.
**1.4.0**
* better way to render multi screen. note:*Only one GLSurfaceView required now* !!
* `.build(R.id.surface_view1,R.id.surface_view2)` => `.build(R.id.surface_view)`
* add motion with touch strategy.
**1.3.0**
* add some reset function, such as `MDVRLibrary#resetPinch`,`MDVRLibrary#resetTouch`
* support sensor delay configuration in motion mode
* support sensorCallback
* fix a crucial bug: has an line in the center of the sphere
**1.2.0**
* pinch gesture supported
* changed the way to listen onClick event
* fix the image distortion on the polar of sphere
**1.1.0**
* Bitmap supported. For more info, See [BitmapPlayerActivity](https://github.com/ashqal/MD360Player4Android/tree/master/app/src/main/java/com/asha/md360player4android/BitmapPlayerActivity.java) in demo.
* Add callback if the TYPE_ROTATION_VECTOR is NOT supported.
* Use more divisions in sphere and load `.obj` file in working thread.
* Bug fix: Can not drag after setOnClickListener.
* Switch to [IjkMediaPlayer](https://github.com/Bilibili/ijkplayer) in demo.
**1.0.0**
* Motion Sensor
* Glass Mode(multi-screen)
* Fix a few bugs.
* More easier.
* Worked with MediaPlayer or ijkMediaPlayer.
## Gradle
```java
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```
```java
dependencies {
compile 'com.github.ashqal:MD360Player4Android:1.5.3'
}
```
## USAGE
### Using with GLSurfaceView
**STEP1** Define `GLSurfaceView` in the layout xml.
```java
<android.opengl.GLSurfaceView
android:id="@+id/surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
```
**STEP2** Init the `MDVRLibrary` in the Activity.
```java
public class MDVRLibraryDemoActivity extends MediaPlayerActivity {
private MDVRLibrary mVRLibrary;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_md_render);
// init VR Library
initVRLibrary();
}
private void initVRLibrary(){
// new instance
mVRLibrary = MDVRLibrary.with(this)
.displayMode(MDVRLibrary.DISPLAY_MODE_NORMAL)
.interactiveMode(MDVRLibrary.INTERACTIVE_MODE_MOTION)
.video(new MDVRLibrary.IOnSurfaceReadyCallback() {
@Override
public void onSurfaceReady(Surface surface) {
// IjkMediaPlayer or MediaPlayer
getPlayer().setSurface(surface);
}
})
.build(R.id.surface_view);
}
}
```
**STEP3** Addition call in `onTouchEvent` `onResume` `onPause` `onDestroy`.
```java
public class MDVRLibraryDemoActivity extends MediaPlayerActivity {
@Override
public boolean onTouchEvent(MotionEvent event) {
return mVRLibrary.handleTouchEvent(event) || super.onTouchEvent(event);
}
@Override
protected void onResume() {
super.onResume();
mVRLibrary.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
mVRLibrary.onPause(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
mVRLibrary.onDestroy();
}
}
```
### Click Listener
`Builder#gesture`
```java
@Override
protected MDVRLibrary createVRLibrary() {
return MDVRLibrary.with(this)
.....
.gesture(new MDVRLibrary.IGestureListener() {
@Override
public void onClick(MotionEvent e) {
Toast.makeText(VideoPlayerActivity.this, "onClick!", Toast.LENGTH_SHORT).show();
}
})
.build(R.id.surface_view);
}
```
### Enable the pinch
`Builder#pinchEnabled`
```java
@Override
protected MDVRLibrary createVRLibrary() {
return MDVRLibrary.with(this)
.....
.pinchEnabled(true) //disable by default
.build(R.id.surface_view);
}
```
### Feature not support callback
add `ifNotSupport` to builder, e.g. [VideoPlayerActivity#createVRLibrary](https://github.c
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Android 360度全景视频播放器 VR播放器 (117个子文件)
gradlew.bat 2KB
.gitignore 110B
.gitignore 7B
.gitignore 7B
per_pixel_vertex_shader.glsl 2KB
per_pixel_fragment_shader.glsl 2KB
per_pixel_fragment_shader_bitmap.glsl 579B
build.gradle 870B
build.gradle 544B
build.gradle 520B
settings.gradle 25B
gradlew 5KB
gradle-wrapper.jar 52KB
GLTextureView.java 65KB
MDVRLibrary.java 18KB
MDBarrelDistortionLinePipe.java 13KB
MD360PlayerActivity.java 12KB
MDMultiFisheyeConvertLinePipe.java 10KB
GLUtil.java 8KB
PlaneProjection.java 8KB
MD360Director.java 8KB
MDPickerManager.java 6KB
MDPlane.java 6KB
MDTouchHelper.java 6KB
VRUtil.java 6KB
MDDome3D.java 5KB
MDSimplePlugin.java 5KB
MDMultiFisheye3D.java 5KB
MediaPlayerWrapper.java 5KB
DemoActivity.java 5KB
MD360BitmapTexture.java 4KB
MDStereoSphere3D.java 4KB
MDSphere3D.java 4KB
MD360Renderer.java 4KB
MotionStrategy.java 4KB
MDPosition.java 3KB
ProjectionModeManager.java 3KB
VideoPlayerActivity.java 3KB
MD360Program.java 3KB
IjkPlayerDemoActivity.java 3KB
MDPanoramaPlugin.java 3KB
MD360VideoTexture.java 3KB
MDAbsObject3D.java 3KB
MDGLScreenWrapper.java 2KB
ModeManager.java 2KB
SpinnerHelper.java 2KB
BitmapPlayerActivity.java 2KB
InteractiveModeManager.java 2KB
MDMainLinePipe.java 2KB
MD360DirectorFactory.java 2KB
DisplayModeManager.java 2KB
BarrelDistortionConfig.java 2KB
MultiFisheyeProjection.java 1KB
TouchStrategy.java 1KB
StereoSphereProjection.java 1KB
DomeProjection.java 1KB
MD360Texture.java 1KB
MDVector3D.java 1KB
MDPluginManager.java 979B
SphereProjection.java 972B
MDAbsPlugin.java 890B
MotionWithTouchStrategy.java 866B
MDObject3DHelper.java 796B
MDRay.java 754B
AbsInteractiveStrategy.java 692B
Fps.java 660B
NormalStrategy.java 650B
GlassStrategy.java 549B
AbsProjectionStrategy.java 544B
MDHandler.java 458B
AbsDisplayStrategy.java 414B
IModeStrategy.java 397B
ApplicationTest.java 359B
ApplicationTest.java 345B
IInteractiveMode.java 323B
ExampleUnitTest.java 321B
IProjectionMode.java 314B
ExampleUnitTest.java 307B
MDAbsLinePipe.java 304B
IMDHotspot.java 287B
IDisplayMode.java 180B
preview2.jpg 264KB
bitmap360.jpg 160KB
stereo.jpg 144KB
dome_pic.jpg 142KB
preview.jpg 124KB
fish2sphere180s.jpg 91KB
preview1.jpg 75KB
LICENSE 11KB
README.md 12KB
texture.png 1001KB
multifisheye2.png 313KB
multifisheye.png 313KB
moredoo_logo.png 14KB
ic_launcher.png 10KB
ic_launcher.png 8KB
ic_launcher.png 5KB
ic_launcher.png 3KB
ic_launcher.png 2KB
proguard-rules.pro 662B
共 117 条
- 1
- 2
资源评论
- qq_280584992018-11-10你好,IPHONE拍摄全景视频,需要前后摄像头同时工作,但据我了解,IPHONE是不能前后同时工作的。 那么你的全景视频是什么原理,如何工作的?
flying1112
- 粉丝: 2
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- python-leetcode面试题解之第157题用Read4读取N个字符-题解.zip
- python-leetcode面试题解之第156题上下翻转二叉树-题解.zip
- python-leetcode面试题解之第155题最小栈-题解.zip
- python-leetcode面试题解之第153题寻找旋转排序数组中的最小值-题解.zip
- python-leetcode面试题解之第152题乘积最大子数组-题解.zip
- python-leetcode面试题解之第151题反转字符串中的单词-题解.zip
- python-leetcode面试题解之第150题逆波兰表达式求值-题解.zip
- python-leetcode面试题解之第149题直线上最多的点数-题解.zip
- python-leetcode面试题解之第148题排序链表-题解.zip
- python-leetcode面试题解之第147题对链表进行插入排序-题解.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功