// Path: glmediaplayer/src/main/java/com/quan404/glmediaplayer/GLMediaPlayer.java
// public class GLMediaPlayer {
//     private final static String TAG = "GLMediaPlayer";
//     private BasePlayer mediaPlayer = null;
//     private Context context = null;
//     private VideoSurfaceView mVideoView;
// 
//     //=================== + Constructors + ===================
//     public GLMediaPlayer(Context context) {
//         this(context, false);
//     }
//     public GLMediaPlayer(Context context, boolean useExoPlayer) {
//         this(context, new DefaultVideoRenderer(context), useExoPlayer);
//     }
// 
//     public GLMediaPlayer(Context context, BaseVideoRenderer renderer, boolean useExoPlayer) {
//         if(renderer == null) {
//             if(LogConfig.ON){
//                 Log.e(TAG, "Renderer is null");
//             }
//             return;
//         }
//         if(useExoPlayer){
//             this.mediaPlayer = new CustomExoPlayer(context);
//         }else{
//             this.mediaPlayer = new AndroidPlayer();
//         }
// 
//         this.context = context;
//         this.mVideoView = new VideoSurfaceView(context, renderer);
//         renderer.setGlMediaPlayer(this);
//     }
// 
//     //=================== + Getter + ===================
// 
//     public VideoSurfaceView getVideoSurfaceView(){
//         return mVideoView;
//     }
// 
//     //=================== + Setter + ===================
//     public void setDataSource(String dataSource) {
//         if (mediaPlayer != null){
//             try {
//                 mediaPlayer.setDataSource(dataSource);
//             } catch (IOException e) {
//                 e.printStackTrace();
//             }
//         }else {
//             if(LogConfig.ON){
//                 Log.e(TAG, "setDataSource: mediaPlayer == null");
//             }
//         }
//     }
// 
//     public void pause(){
//         if(LogConfig.ON){
//             Log.d(TAG, "pause()");
//         }
// 
//         if(mediaPlayer.isPlaying()){
//             mediaPlayer.pause();
//         }
//     }
// 
//     public void resume(){
//         if(LogConfig.ON){
//             Log.d(TAG, "resume()");
//         }
//         // TODO: Resume player
// 
//         if(mVideoView != null){
//             if( mVideoView.getRenderer().isReady()){
//                 if(mediaPlayer instanceof CustomExoPlayer) {
//                     CustomExoPlayer exoPlayer = (CustomExoPlayer) this.mediaPlayer;
//                     exoPlayer.resume();
//                 } else {
//                     this.mediaPlayer.start();
//                 }
//             }
//         }
//     }
// 
//     public void setSurface(Surface surface) {
//         this.mediaPlayer.setSurface(surface);
//     }
// 
//     public void prepare() {
//         try{
//             this.mediaPlayer.prepare();
//         }catch (Exception e){
//             e.printStackTrace();
//         }
//     }
// 
//     public void start() {
//         try{
//             this.mediaPlayer.start();
//         }catch (Exception e){
//             e.printStackTrace();
//         }
//     }
//     public void setOnVideoSizeChangedListener(BasePlayer.OnVideoSizeChangedListener listener){
//         this.mediaPlayer.setOnVideoSizeChangedListener(listener);
//     }
// 
//     public BasePlayer getMediaPlayer() {
//         return mediaPlayer;
//     }
// }


import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import com.quan404.glmediaplayer.GLMediaPlayer;
package com.quan404.basic_custom_exo_player;



public class MainActivity extends AppCompatActivity {

    private GLMediaPlayer glMediaPlayer = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        glMediaPlayer = new GLMediaPlayer(this, true);
        try{
//            glMediaPlayer.setDataSource("http://html5demos.com/assets/dizzy.mp4");
// Path: glmediaplayer/src/main/java/com/quan404/glmediaplayer/GLMediaPlayer.java
// public class GLMediaPlayer {
//     private final static String TAG = "GLMediaPlayer";
//     private BasePlayer mediaPlayer = null;
//     private Context context = null;
//     private VideoSurfaceView mVideoView;
// 
//     //=================== + Constructors + ===================
//     public GLMediaPlayer(Context context) {
//         this(context, false);
//     }
//     public GLMediaPlayer(Context context, boolean useExoPlayer) {
//         this(context, new DefaultVideoRenderer(context), useExoPlayer);
//     }
// 
//     public GLMediaPlayer(Context context, BaseVideoRenderer renderer, boolean useExoPlayer) {
//         if(renderer == null) {
//             if(LogConfig.ON){
//                 Log.e(TAG, "Renderer is null");
//             }
//             return;
//         }
//         if(useExoPlayer){
//             this.mediaPlayer = new CustomExoPlayer(context);
//         }else{
//             this.mediaPlayer = new AndroidPlayer();
//         }
// 
//         this.context = context;
//         this.mVideoView = new VideoSurfaceView(context, renderer);
//         renderer.setGlMediaPlayer(this);
//     }
// 
//     //=================== + Getter + ===================
// 
//     public VideoSurfaceView getVideoSurfaceView(){
//         return mVideoView;
//     }
// 
//     //=================== + Setter + ===================
//     public void setDataSource(String dataSource) {
//         if (mediaPlayer != null){
//             try {
//                 mediaPlayer.setDataSource(dataSource);
//             } catch (IOException e) {
//                 e.printStackTrace();
//             }
//         }else {
//             if(LogConfig.ON){
//                 Log.e(TAG, "setDataSource: mediaPlayer == null");
//             }
//         }
//     }
// 
//     public void pause(){
//         if(LogConfig.ON){
//             Log.d(TAG, "pause()");
//         }
// 
//         if(mediaPlayer.isPlaying()){
//             mediaPlayer.pause();
//         }
//     }
// 
//     public void resume(){
//         if(LogConfig.ON){
//             Log.d(TAG, "resume()");
//         }
//         // TODO: Resume player
// 
//         if(mVideoView != null){
//             if( mVideoView.getRenderer().isReady()){
//                 if(mediaPlayer instanceof CustomExoPlayer) {
//                     CustomExoPlayer exoPlayer = (CustomExoPlayer) this.mediaPlayer;
//                     exoPlayer.resume();
//                 } else {
//                     this.mediaPlayer.start();
//                 }
//             }
//         }
//     }
// 
//     public void setSurface(Surface surface) {
//         this.mediaPlayer.setSurface(surface);
//     }
// 
//     public void prepare() {
//         try{
//             this.mediaPlayer.prepare();
//         }catch (Exception e){
//             e.printStackTrace();
//         }
//     }
// 
//     public void start() {
//         try{
//             this.mediaPlayer.start();
//         }catch (Exception e){
//             e.printStackTrace();
//         }
//     }
//     public void setOnVideoSizeChangedListener(BasePlayer.OnVideoSizeChangedListener listener){
//         this.mediaPlayer.setOnVideoSizeChangedListener(listener);
//     }
// 
//     public BasePlayer getMediaPlayer() {
//         return mediaPlayer;
//     }
// }


// Path: 04_basic_custom_exo_player/src/main/java/com/quan404/basic_custom_exo_player/MainActivity.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import com.quan404.glmediaplayer.GLMediaPlayer;

package com.quan404.basic_custom_exo_player;



public class MainActivity extends AppCompatActivity {

    private GLMediaPlayer glMediaPlayer = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        glMediaPlayer = new GLMediaPlayer(this, true);
        try{
//            glMediaPlayer.setDataSource("http://html5demos.com/assets/dizzy.mp4");
            glMediaPlayer.setDataSource("http://d2kzl73ve6fjh6.cloudfront.net/videos/teleport_22-11-2015_13-11-40__8kX6dwsyML.mp4");