Giter Club home page Giter Club logo

md360player4android's Introduction

MD360Player4Android

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

Preview

ScreenShot

Demo APK

MD360PlayerDemo.apk(21.7M, 360 demo video included)

NOTICE

  • OpenGLES 2.0 required
  • Android 4.0.3 (IceCreamSandwich API-15) required

Gradle

Coming soon.

USAGE

There are two way to use this library depend on your requirement,

Using MDGLSurfaceView

STEP1 define com.asha.vrlib.MDGLSurfaceView in the layout xml.

...
   <com.asha.vrlib.MDGLSurfaceView
       android:id="@+id/md_surface_view"
       android:layout_width="match_parent"
       android:layout_height="match_parent" />
...

STEP2 attach the android.view.Surface to your MediaPlayer or something else when the surface is ready.

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);
            }
        });
    }
}

More Flexible Way: MD360Renderer

STEP1 build a MD360Renderer and attach the 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);
    }
}

STEP2 init OpenGL by yourself, and set the MD360Renderer to your 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

LICENSE

The MIT License (MIT)

Copyright (c) 2016 Asha

md360player4android's People

Contributors

ashqal avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.