// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/media/utils/ExoPlayerEventListenerImpl.java
// public class ExoPlayerEventListenerImpl implements Player.EventListener {
//     @Override
//     public void onTimelineChanged(Timeline timeline, Object manifest) {
// 
//     }
// 
//     @Override
//     public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
// 
//     }
// 
//     @Override
//     public void onLoadingChanged(boolean isLoading) {
// 
//     }
// 
//     @Override
//     public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
// 
//     }
// 
//     @Override
//     public void onRepeatModeChanged(int repeatMode) {
// 
//     }
// 
//     @Override
//     public void onPlayerError(ExoPlaybackException error) {
// 
//     }
// 
//     @Override
//     public void onPositionDiscontinuity() {
// 
//     }
// 
//     @Override
//     public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
// 
//     }
// }
// 
// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/media/utils/SimpleExoPlayerInitializer.java
// public class SimpleExoPlayerInitializer {
// 
//     public static SimpleExoPlayer initializeExoPlayer(Context context) {
//         return ExoPlayerFactory.newSimpleInstance(
//                 new DefaultRenderersFactory(context),
//                 new DefaultTrackSelector(), new DefaultLoadControl());
//     }
// 
//     public static MediaSource buildMediaSource(Uri uri, Context context) {
//         String userAgent = Util.getUserAgent(context, context.getResources().getString(R.string.app_name));
//         return new ExtractorMediaSource(uri,
//                 new DefaultHttpDataSourceFactory(userAgent),
//                 new DefaultExtractorsFactory(), null, null);
//     }
// }
// 
// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/media/utils/VideoRendererEventListenerImpl.java
// public class VideoRendererEventListenerImpl implements VideoRendererEventListener {
//     @Override
//     public void onVideoEnabled(DecoderCounters counters) {
// 
//     }
// 
//     @Override
//     public void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) {
// 
//     }
// 
//     @Override
//     public void onVideoInputFormatChanged(Format format) {
// 
//     }
// 
//     @Override
//     public void onDroppedFrames(int count, long elapsedMs) {
// 
//     }
// 
//     @Override
//     public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
// 
//     }
// 
//     @Override
//     public void onRenderedFirstFrame(Surface surface) {
// 
//     }
// 
//     @Override
//     public void onVideoDisabled(DecoderCounters counters) {
// 
//     }
// }


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Matrix;
import android.net.Uri;
import android.os.Bundle;
import android.view.TextureView;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
import com.google.android.exoplayer2.util.Util;
import com.quickblox.ui.kit.chatmessage.adapter.R;
import com.quickblox.ui.kit.chatmessage.adapter.media.utils.ExoPlayerEventListenerImpl;
import com.quickblox.ui.kit.chatmessage.adapter.media.utils.SimpleExoPlayerInitializer;
import com.quickblox.ui.kit.chatmessage.adapter.media.utils.VideoRendererEventListenerImpl;
    public void onPause() {
        super.onPause();
        if (Util.SDK_INT <= 23) {
            releasePlayer();
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        if (Util.SDK_INT > 23) {
            releasePlayer();
        }
    }

    private void setScreenOrientationPortrait() {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    private void initViews() {
        simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
        textureView = (TextureView) simpleExoPlayerView.getVideoSurfaceView();
    }

    private void initFields() {
        videoUri = getIntent().getParcelableExtra(EXTRA_VIDEO_URI);
        shouldAutoPlay = true;
    }

    private void initializePlayer() {
// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/media/utils/ExoPlayerEventListenerImpl.java
// public class ExoPlayerEventListenerImpl implements Player.EventListener {
//     @Override
//     public void onTimelineChanged(Timeline timeline, Object manifest) {
// 
//     }
// 
//     @Override
//     public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
// 
//     }
// 
//     @Override
//     public void onLoadingChanged(boolean isLoading) {
// 
//     }
// 
//     @Override
//     public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
// 
//     }
// 
//     @Override
//     public void onRepeatModeChanged(int repeatMode) {
// 
//     }
// 
//     @Override
//     public void onPlayerError(ExoPlaybackException error) {
// 
//     }
// 
//     @Override
//     public void onPositionDiscontinuity() {
// 
//     }
// 
//     @Override
//     public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
// 
//     }
// }
// 
// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/media/utils/SimpleExoPlayerInitializer.java
// public class SimpleExoPlayerInitializer {
// 
//     public static SimpleExoPlayer initializeExoPlayer(Context context) {
//         return ExoPlayerFactory.newSimpleInstance(
//                 new DefaultRenderersFactory(context),
//                 new DefaultTrackSelector(), new DefaultLoadControl());
//     }
// 
//     public static MediaSource buildMediaSource(Uri uri, Context context) {
//         String userAgent = Util.getUserAgent(context, context.getResources().getString(R.string.app_name));
//         return new ExtractorMediaSource(uri,
//                 new DefaultHttpDataSourceFactory(userAgent),
//                 new DefaultExtractorsFactory(), null, null);
//     }
// }
// 
// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/media/utils/VideoRendererEventListenerImpl.java
// public class VideoRendererEventListenerImpl implements VideoRendererEventListener {
//     @Override
//     public void onVideoEnabled(DecoderCounters counters) {
// 
//     }
// 
//     @Override
//     public void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) {
// 
//     }
// 
//     @Override
//     public void onVideoInputFormatChanged(Format format) {
// 
//     }
// 
//     @Override
//     public void onDroppedFrames(int count, long elapsedMs) {
// 
//     }
// 
//     @Override
//     public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
// 
//     }
// 
//     @Override
//     public void onRenderedFirstFrame(Surface surface) {
// 
//     }
// 
//     @Override
//     public void onVideoDisabled(DecoderCounters counters) {
// 
//     }
// }


// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/media/video/ui/VideoPlayerActivity.java
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Matrix;
import android.net.Uri;
import android.os.Bundle;
import android.view.TextureView;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
import com.google.android.exoplayer2.util.Util;
import com.quickblox.ui.kit.chatmessage.adapter.R;
import com.quickblox.ui.kit.chatmessage.adapter.media.utils.ExoPlayerEventListenerImpl;
import com.quickblox.ui.kit.chatmessage.adapter.media.utils.SimpleExoPlayerInitializer;
import com.quickblox.ui.kit.chatmessage.adapter.media.utils.VideoRendererEventListenerImpl;

    public void onPause() {
        super.onPause();
        if (Util.SDK_INT <= 23) {
            releasePlayer();
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        if (Util.SDK_INT > 23) {
            releasePlayer();
        }
    }

    private void setScreenOrientationPortrait() {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    private void initViews() {
        simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
        textureView = (TextureView) simpleExoPlayerView.getVideoSurfaceView();
    }

    private void initFields() {
        videoUri = getIntent().getParcelableExtra(EXTRA_VIDEO_URI);
        shouldAutoPlay = true;
    }

    private void initializePlayer() {
        player = SimpleExoPlayerInitializer.initializeExoPlayer(this);