Skip to content

Repository files navigation

MD360Player4Android

It is a lite library to render 360 degree panorama video for Android.

Preview

ScreenShot

NOTICE

  • OpenGLES 2.0 required
  • Android 4.1 (JellyBean API-16) 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

  • pinch gesture supported
  • changed the way to listen onClick event
  • for example,
@OverrideprotectedMDVRLibrarycreateVRLibrary() {
returnMDVRLibrary.with(this)
.....
.pinchEnabled(true)
.gesture(newMDVRLibrary.IGestureListener() {
@OverridepublicvoidonClick(MotionEvente) {
Toast.makeText(VideoPlayerActivity.this, "onClick!", Toast.LENGTH_SHORT).show();
}
})
.build(R.id.surface_view1,R.id.surface_view2);
}

Release Note

1.1.0

  • Bitmap supported. For more info, See BitmapPlayerActivity 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 in demo.

1.0.0

  • Motion Sensor
  • Glass Mode(multi-screen)
  • Fix a few bugs.
  • More easier.
  • Worked with MediaPlayer or ijkMediaPlayer.

Gradle

allprojects {
repositories {
...
maven { url"https://jitpack.io" }
}
}
dependencies {
compile'com.github.ashqal:MD360Player4Android:1.1.0'
}

USAGE

Using with GLSurfaceView

STEP1 Define GLSurfaceView in the layout xml.

<android.opengl.GLSurfaceViewandroid:id="@+id/surface_view"android:layout_width="match_parent"android:layout_height="match_parent" />

STEP2 Init the MDVRLibrary in the Activity.

publicclassMDVRLibraryDemoActivityextendsMediaPlayerActivity {
privateMDVRLibrarymVRLibrary;
@OverridepublicvoidonCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_md_render);
// init VR LibraryinitVRLibrary();
}
privatevoidinitVRLibrary(){
// new instancemVRLibrary = MDVRLibrary.with(this)
.displayMode(MDVRLibrary.DISPLAY_MODE_NORMAL)
.interactiveMode(MDVRLibrary.INTERACTIVE_MODE_MOTION)
.video(newMDVRLibrary.IOnSurfaceReadyCallback() {
@OverridepublicvoidonSurfaceReady(Surfacesurface) {
// IjkMediaPlayer or MediaPlayergetPlayer().setSurface(surface);
}
})
.build(R.id.surface_view);
}
}

STEP3 Addition call in onTouchEventonResumeonPauseonDestroy.

publicclassMDVRLibraryDemoActivityextendsMediaPlayerActivity {
@OverridepublicbooleanonTouchEvent(MotionEventevent) {
returnmVRLibrary.handleTouchEvent(event) || super.onTouchEvent(event);
}
@OverrideprotectedvoidonResume() {
super.onResume();
mVRLibrary.onResume(this);
}
@OverrideprotectedvoidonPause() {
super.onPause();
mVRLibrary.onPause(this);
}
@OverrideprotectedvoidonDestroy() {
super.onDestroy();
mVRLibrary.onDestroy();
}
}

Feature not support callback

add ifNotSupport to builder, e.g. VideoPlayerActivity#createVRLibrary

@OverrideprotectedMDVRLibrarycreateVRLibrary() {
returnMDVRLibrary.with(this)
.....
.ifNotSupport(newMDVRLibrary.INotSupportCallback() {
@OverridepublicvoidonNotSupport(intmode) {
Stringtip = mode == MDVRLibrary.INTERACTIVE_MODE_MOTION
? "onNotSupport:MOTION" : "onNotSupport:" + String.valueOf(mode);
Toast.makeText(VideoPlayerActivity.this, tip, Toast.LENGTH_SHORT).show();
}
})
.build(R.id.surface_view1,R.id.surface_view2);
}

Reference

iOS Version

MD360Player4iOS ##LICENSE

Copyright 2016 Asha
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

It is a lite library to render 360 degree panorama video for Android. VR Player.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages