Benjamin
Benjamin

Reputation: 2286

How to detect video is Vertical or Horizontal in ExoPlayer

I have m3u8 Hls Url how can I find in Exoplayer video properties to find video is Vertical or Horizontal.

Upvotes: 0

Views: 487

Answers (1)

Raafat Alhmidi
Raafat Alhmidi

Reputation: 1176

add event listener to your MediaSource and override onLoadCompleted

MediaSource mediaSource = buildMediaSource(url);
mediaSource.addEventListener(new Handler(), new DefaultMediaSourceEventListener() {                   
                @Override
                public void onLoadCompleted(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) {
                    super.onLoadCompleted(windowIndex, mediaPeriodId, loadEventInfo, mediaLoadData);
                    if(mediaLoadData.trackFormat.width > mediaLoadData.trackFormat.height){

                    }else{

                    }
                }
            });

Upvotes: 1

Related Questions