/FileExtraction/Java_unseen/PowerExplorer_PowerFileExplorer/PowerFileExplorer/src/main/java/com/google/android/exoplayer2/demo/MediaPlayerFragment2.java
///*
// * Copyright (C) 2016 The Android Open Source Project
// *
// * 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.
// */
//package com.google.android.exoplayer2.demo;
//
//import android.app.Activity;
//import android.content.Intent;
//import android.content.pm.PackageManager;
//import android.net.Uri;
//import android.os.Bundle;
//import android.os.Handler;
//import android.support.annotation.NonNull;
//import android.text.TextUtils;
//import android.view.KeyEvent;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.widget.Button;
//import android.widget.LinearLayout;
//import android.widget.TextView;
//import android.widget.Toast;
//import com.google.android.exoplayer2.C;
//import com.google.android.exoplayer2.DefaultRenderersFactory;
//import com.google.android.exoplayer2.ExoPlaybackException;
//import com.google.android.exoplayer2.ExoPlayer;
//import com.google.android.exoplayer2.ExoPlayerFactory;
//import com.google.android.exoplayer2.PlaybackParameters;
//import com.google.android.exoplayer2.SimpleExoPlayer;
//import com.google.android.exoplayer2.Timeline;
//import com.google.android.exoplayer2.drm.DefaultDrmSessionManager;
//import com.google.android.exoplayer2.drm.DrmSessionManager;
//import com.google.android.exoplayer2.drm.FrameworkMediaCrypto;
//import com.google.android.exoplayer2.drm.FrameworkMediaDrm;
//import com.google.android.exoplayer2.drm.HttpMediaDrmCallback;
//import com.google.android.exoplayer2.drm.UnsupportedDrmException;
//import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
//import com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.DecoderInitializationException;
//import com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException;
//import com.google.android.exoplayer2.source.BehindLiveWindowException;
//import com.google.android.exoplayer2.source.ConcatenatingMediaSource;
//import com.google.android.exoplayer2.source.ExtractorMediaSource;
//import com.google.android.exoplayer2.source.MediaSource;
//import com.google.android.exoplayer2.source.TrackGroupArray;
//import com.google.android.exoplayer2.source.dash.DashMediaSource;
//import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource;
//import com.google.android.exoplayer2.source.hls.HlsMediaSource;
//import com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource;
//import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource;
//import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
//import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
//import com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo;
//import com.google.android.exoplayer2.trackselection.TrackSelection;
//import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
//import com.google.android.exoplayer2.ui.DebugTextViewHelper;
//import com.google.android.exoplayer2.ui.PlaybackControlView;
//import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
//import com.google.android.exoplayer2.upstream.DataSource;
//import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
//import com.google.android.exoplayer2.upstream.HttpDataSource;
//import com.google.android.exoplayer2.util.Util;
//import java.net.CookieHandler;
//import java.net.CookieManager;
//import java.net.CookiePolicy;
//import java.util.UUID;
//import net.gnu.explorer.R;
//import net.gnu.explorer.Frag;
//import android.util.Log;
//import android.view.ViewGroup;
//import android.view.LayoutInflater;
//import java.io.File;
//import net.gnu.explorer.ExplorerActivity;
//import net.gnu.explorer.ExplorerApplication;
//
///**
// * An activity that plays media using {@link SimpleExoPlayer}.
// */
//public class MediaPlayerFragment2 extends Frag implements OnClickListener, ExoPlayer.EventListener,
//PlaybackControlView.VisibilityListener {
//
//	public static final String DRM_SCHEME_UUID_EXTRA = "drm_scheme_uuid";
//	public static final String DRM_LICENSE_URL = "drm_license_url";
//	public static final String DRM_KEY_REQUEST_PROPERTIES = "drm_key_request_properties";
//	public static final String PREFER_EXTENSION_DECODERS = "prefer_extension_decoders";
//
//	public static final String ACTION_VIEW = "com.google.android.exoplayer.demo.action.VIEW";
//	public static final String EXTENSION_EXTRA = "extension";
//
//	public static final String ACTION_VIEW_LIST =
//	"com.google.android.exoplayer.demo.action.VIEW_LIST";
//	public static final String URI_LIST_EXTRA = "uri_list";
//	public static final String EXTENSION_LIST_EXTRA = "extension_list";
//
//	private static final DefaultBandwidthMeter BANDWIDTH_METER = new DefaultBandwidthMeter();
//	private static final CookieManager DEFAULT_COOKIE_MANAGER;
//
//	private final String TAG = "MediaPlayerFragment";
//	static {
//		DEFAULT_COOKIE_MANAGER = new CookieManager();
//		DEFAULT_COOKIE_MANAGER.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
//	}
//
//	private Handler mainHandler;
//	private EventLogger eventLogger;
//	private SimpleExoPlayerView simpleExoPlayerView;
//	private LinearLayout debugRootView;
//	private TextView debugTextView;
//	private Button retryButton;
//
//	private DataSource.Factory mediaDataSourceFactory;
//	private SimpleExoPlayer player;
//	private DefaultTrackSelector trackSelector;
//	private TrackSelectionHelper trackSelectionHelper;
//	private DebugTextViewHelper debugViewHelper;
//	private boolean needRetrySource;
//	private TrackGroupArray lastSeenTrackGroupArray;
//
//	private boolean shouldAutoPlay;
//	private int resumeWindow;
//	private long resumePosition;
//
//	// Activity lifecycle
//	public MediaPlayerFragment() {
//		super();
//		type = Frag.TYPE.MEDIA.ordinal();
//	}
//
//	@Override
//	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//		Log.d(TAG, "onCreateView");
//		setHasOptionsMenu(false);
//		return inflater.inflate(R.layout.player_activity, container, false);//rootView;//
//	}
//	
//	@Override
//	public void onViewCreated(View v, Bundle savedInstanceState) {
//		//@Override
//		//public void onCreate(Bundle savedInstanceState) {
//		super.onViewCreated(v, savedInstanceState);
//		shouldAutoPlay = true;
//		clearResumePosition();
//		mediaDataSourceFactory = buildDataSourceFactory(true);
//		mainHandler = new Handler();
//		if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) {
//			CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
//		}
//
//		//setContentView(R.layout.player_activity);
//		View rootView = v.findViewById(R.id.root);
//		rootView.setOnClickListener(this);
//		debugRootView = (LinearLayout) v.findViewById(R.id.controls_root);
//		debugTextView = (TextView) v.findViewById(R.id.debug_text_view);
//		retryButton = (Button) v.findViewById(R.id.retry_button);
//		retryButton.setOnClickListener(this);
//
//		simpleExoPlayerView = (SimpleExoPlayerView) v.findViewById(R.id.player_view);
//		simpleExoPlayerView.setControllerVisibilityListener(this);
//		simpleExoPlayerView.requestFocus();
//		
//		final Intent intent = getActivity().getIntent();
//		if (intent != null) {
//			Uri extras = intent.getData();
//			if (extras != null) {
//				CURRENT_PATH = extras.getPath();
//				Log.d(TAG, "intent.getData() " + CURRENT_PATH);
//			}
//		}
//		updateColor(rootView);
//	}
//
//	//@Override
//	public void onNewIntent(Intent intent) {
//		releasePlayer();
//		shouldAutoPlay = true;
//		clearResumePosition();
//		fragActivity.setIntent(intent);
//	}
//	
//	public void clone(final Frag fragO) {}
//
//	public void load(String path) {
//		Log.d(TAG, "path " + path);
//		if (path != null) {
//			//doCleanUp();
//			//player.release();//.releaseMediaPlayer();
//			this.CURRENT_PATH = path;
//			File file = new File(path);
//			MediaSource mediaSource = buildMediaSource(Uri.fromFile(file), null);//extensions[i]);
//			boolean haveResumePosition = resumeWindow != C.INDEX_UNSET;
//			if (haveResumePosition) {
//				player.seekTo(resumeWindow, resumePosition);
//			}
//			player.prepare(mediaSource, !haveResumePosition, false);
//			needRetrySource = false;
//			updateButtonVisibilities();
//		}
//	}
//
//	public void updateColor(View root) {
//		getView().setBackgroundColor(ExplorerActivity.BASE_BACKGROUND);
//		debugTextView.setTextColor(ExplorerActivity.TEXT_COLOR);
////		debugRootView.setBackgroundColor(ExplorerfragActivity.BASE_BACKGROUND);
//		root.setBackgroundColor(ExplorerActivity.BASE_BACKGROUND);
//		simpleExoPlayerView.setBackgroundColor(ExplorerActivity.BASE_BACKGROUND);
//	}
//	
//	@Override
//	public void onStart() {
//		super.onStart();
//		if (Util.SDK_INT > 23) {
//			initializePlayer();
//			Log.d(TAG, "path " + CURRENT_PATH);
//			load(CURRENT_PATH);
//		}
//	}
//
//	@Override
//	public void onResume() {
//		super.onResume();
//		if ((Util.SDK_INT <= 23 || player == null)) {
//			initializePlayer();
//			Log.d(TAG, "path " + CURRENT_PATH);
//			load(CURRENT_PATH);
//		}
//	}
//
//	@Override
//	public void onPause() {
//		super.onPause();
//		if (Util.SDK_INT <= 23) {
//			releasePlayer();
//		}
//	}
//
//	@Override
//	public void onStop() {
//		super.onStop();
//		if (Util.SDK_INT > 23) {
//			releasePlayer();
//		}
//	}
//
//	@Override
//	public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
//										   @NonNull int[] grantResults) {
//		if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//			initializePlayer();
//		} else {
//			showToast(R.string.storage_permission_denied);
//			fragActivity.finish();
//		}
//	}
//
//	// Activity input
//
//	//@Override
//	public boolean dispatchKeyEvent(KeyEvent event) {
//		// Show the controls on any key event.
//		simpleExoPlayerView.showController();
//		// If the event was not handled then see if the player view can handle it as a media key event.
//		return /*super.dispatchKeyEvent(event) || */simpleExoPlayerView.dispatchMediaKeyEvent(event);
//	}
//
//	// OnClickListener methods
//
//	@Override
//	public void onClick(View view) {
//		if (view == retryButton) {
//			initializePlayer();
//		} else if (view.getParent() == debugRootView) {
//			MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
//			if (mappedTrackInfo != null) {
//				trackSelectionHelper.showSelectionDialog(fragActivity, ((Button) view).getText(),
//														 trackSelector.getCurrentMappedTrackInfo(), (int) view.getTag());
//			}
//		}
//	}
//
//	// PlaybackControlView.VisibilityListener implementation
//
//	@Override
//	public void onVisibilityChange(int visibility) {
//		debugRootView.setVisibility(visibility);
//		debugTextView.setVisibility(visibility);
//	}
//
//	// Internal methods
//
//	private void initializePlayer() {
//		final Intent intent = fragActivity.getIntent();
//		boolean needNewPlayer = player == null;
//		if (needNewPlayer) {
//			TrackSelection.Factory adaptiveTrackSelectionFactory =
//				new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);
//			trackSelector = new DefaultTrackSelector(adaptiveTrackSelectionFactory);
//			trackSelectionHelper = new TrackSelectionHelper(trackSelector, adaptiveTrackSelectionFactory);
//			lastSeenTrackGroupArray = null;
//			eventLogger = new EventLogger(trackSelector);
//
//			UUID drmSchemeUuid = intent.hasExtra(DRM_SCHEME_UUID_EXTRA)
//				? UUID.fromString(intent.getStringExtra(DRM_SCHEME_UUID_EXTRA)) : null;
//			DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = null;
//			if (drmSchemeUuid != null) {
//				String drmLicenseUrl = intent.getStringExtra(DRM_LICENSE_URL);
//				String[] keyRequestPropertiesArray = intent.getStringArrayExtra(DRM_KEY_REQUEST_PROPERTIES);
//				try {
//					drmSessionManager = buildDrmSessionManager(drmSchemeUuid, drmLicenseUrl,
//															   keyRequestPropertiesArray);
//				} catch (UnsupportedDrmException e) {
//					int errorStringId = Util.SDK_INT < 18 ? R.string.error_drm_not_supported
//						: (e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
//						? R.string.error_drm_unsupported_scheme : R.string.error_drm_unknown);
//					showToast(errorStringId);
//					return;
//				}
//			}
//
//			boolean preferExtensionDecoders = intent.getBooleanExtra(PREFER_EXTENSION_DECODERS, false);
//			@DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode =
//				((ExplorerApplication) fragActivity.getApplication()).useExtensionRenderers()
//				? (preferExtensionDecoders ? DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER
//				: DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON)
//				: DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF;
//			DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(fragActivity,
//																				   drmSessionManager, extensionRendererMode);
//
//			player = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector);
//			player.addListener(this);
//			player.addListener(eventLogger);
//			player.setAudioDebugListener(eventLogger);
//			player.setVideoDebugListener(eventLogger);
//			player.setMetadataOutput(eventLogger);
//
//			simpleExoPlayerView.setPlayer(player);
//			player.setPlayWhenReady(shouldAutoPlay);
//			debugViewHelper = new DebugTextViewHelper(player, debugTextView);
//			debugViewHelper.start();
//		}
//		if (needNewPlayer || needRetrySource) {
//			final String action = intent.getAction();
//			Log.d(TAG, "action " + action);
//			Uri[] uris;
//			String[] extensions;
//			if (Intent.ACTION_VIEW.equals(action)) {
//				uris = new Uri[] {intent.getData()};
//				extensions = new String[] {intent.getStringExtra(EXTENSION_EXTRA)};
//			} else if (ACTION_VIEW.equals(action)) {
//				uris = new Uri[] {intent.getData()};
//				extensions = new String[] {intent.getStringExtra(EXTENSION_EXTRA)};
//			} else if (ACTION_VIEW_LIST.equals(action)) {
//				String[] uriStrings = intent.getStringArrayExtra(URI_LIST_EXTRA);
//				uris = new Uri[uriStrings.length];
//				for (int i = 0; i < uriStrings.length; i++) {
//					uris[i] = Uri.parse(uriStrings[i]);
//				}
//				extensions = intent.getStringArrayExtra(EXTENSION_LIST_EXTRA);
//				if (extensions == null) {
//					extensions = new String[uriStrings.length];
//				}
//			} else {
//				if (!Intent.ACTION_MAIN.equals(action)) {
//					showToast(getString(R.string.unexpected_intent_action, action));
//				}
//				return;
//			}
//			if (Util.maybeRequestReadExternalStoragePermission(fragActivity, uris)) {
//				// The player will be reinitialized if the permission is granted.
//				return;
//			}
//			final MediaSource[] mediaSources = new MediaSource[uris.length];
//			for (int i = 0; i < uris.length; i++) {
//				mediaSources[i] = buildMediaSource(uris[i], extensions[i]);
//			}
//			final MediaSource mediaSource = mediaSources.length == 1 ? mediaSources[0]
//				: new ConcatenatingMediaSource(mediaSources);
//			final boolean haveResumePosition = resumeWindow != C.INDEX_UNSET;
//			if (haveResumePosition) {
//				player.seekTo(resumeWindow, resumePosition);
//			}
//			player.prepare(mediaSource, !haveResumePosition, false);
//			needRetrySource = false;
//			updateButtonVisibilities();
//		}
//	}
//
//	private MediaSource buildMediaSource(Uri uri, String overrideExtension) {
//		int type = TextUtils.isEmpty(overrideExtension) ? Util.inferContentType(uri)
//			: Util.inferContentType("." + overrideExtension);
//		switch (type) {
//			case C.TYPE_SS:
//				return new SsMediaSource(uri, buildDataSourceFactory(false),
//										 new DefaultSsChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
//			case C.TYPE_DASH:
//				return new DashMediaSource(uri, buildDataSourceFactory(false),
//										   new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger);
//			case C.TYPE_HLS:
//				return new HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, eventLogger);
//			case C.TYPE_OTHER:
//				return new ExtractorMediaSource(uri, mediaDataSourceFactory, new DefaultExtractorsFactory(),
//												mainHandler, eventLogger);
//			default: {
//					throw new IllegalStateException("Unsupported type: " + type);
//				}
//		}
//	}
//
//	private DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(UUID uuid,
//																		   String licenseUrl, String[] keyRequestPropertiesArray) throws UnsupportedDrmException {
//		if (Util.SDK_INT < 18) {
//			return null;
//		}
//		HttpMediaDrmCallback drmCallback = new HttpMediaDrmCallback(licenseUrl,
//																	buildHttpDataSourceFactory(false));
//		if (keyRequestPropertiesArray != null) {
//			for (int i = 0; i < keyRequestPropertiesArray.length - 1; i += 2) {
//				drmCallback.setKeyRequestProperty(keyRequestPropertiesArray[i],
//												  keyRequestPropertiesArray[i + 1]);
//			}
//		}
//		return new DefaultDrmSessionManager<FrameworkMediaCrypto>(uuid,
//											  FrameworkMediaDrm.newInstance(uuid), drmCallback, null, mainHandler, eventLogger);
//	}
//
//	private void releasePlayer() {
//		if (player != null) {
//			debugViewHelper.stop();
//			debugViewHelper = null;
//			shouldAutoPlay = player.getPlayWhenReady();
//			updateResumePosition();
//			player.release();
//			player = null;
//			trackSelector = null;
//			trackSelectionHelper = null;
//			eventLogger = null;
//		}
//	}
//
//	private void updateResumePosition() {
//		resumeWindow = player.getCurrentWindowIndex();
//		resumePosition = player.isCurrentWindowSeekable() ? Math.max(0, player.getCurrentPosition())
//			: C.TIME_UNSET;
//	}
//
//	private void clearResumePosition() {
//		resumeWindow = C.INDEX_UNSET;
//		resumePosition = C.TIME_UNSET;
//	}
//
//	/**
//	 * Returns a new DataSource factory.
//	 *
//	 * @param useBandwidthMeter Whether to set {@link #BANDWIDTH_METER} as a listener to the new
//	 *     DataSource factory.
//	 * @return A new DataSource factory.
//	 */
//	private DataSource.Factory buildDataSourceFactory(boolean useBandwidthMeter) {
//		return ((ExplorerApplication) fragActivity.getApplication())
//			.buildDataSourceFactory(useBandwidthMeter ? BANDWIDTH_METER : null);
//	}
//
//	/**
//	 * Returns a new HttpDataSource factory.
//	 *
//	 * @param useBandwidthMeter Whether to set {@link #BANDWIDTH_METER} as a listener to the new
//	 *     DataSource factory.
//	 * @return A new HttpDataSource factory.
//	 */
//	private HttpDataSource.Factory buildHttpDataSourceFactory(boolean useBandwidthMeter) {
//		return ((ExplorerApplication) fragActivity.getApplication())
//			.buildHttpDataSourceFactory(useBandwidthMeter ? BANDWIDTH_METER : null);
//	}
//
//	// ExoPlayer.EventListener implementation
//
//	@Override
//	public void onLoadingChanged(boolean isLoading) {
//		// Do nothing.
//	}
//
//	@Override
//	public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
//		if (playbackState == ExoPlayer.STATE_ENDED) {
//			showControls();
//		}
//		updateButtonVisibilities();
//	}
//
//	@Override
//	public void onPositionDiscontinuity() {
//		if (needRetrySource) {
//			// This will only occur if the user has performed a seek whilst in the error state. Update the
//			// resume position so that if the user then retries, playback will resume from the position to
//			// which they seeked.
//			updateResumePosition();
//		}
//	}
//
//	@Override
//	public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
//		// Do nothing.
//	}
//
//	@Override
//	public void onTimelineChanged(Timeline timeline, Object manifest) {
//		// Do nothing.
//	}
//
//	@Override
//	public void onPlayerError(ExoPlaybackException e) {
//		String errorString = null;
//		if (e.type == ExoPlaybackException.TYPE_RENDERER) {
//			Exception cause = e.getRendererException();
//			if (cause instanceof DecoderInitializationException) {
//				// Special case for decoder initialization failures.
//				DecoderInitializationException decoderInitializationException =
//					(DecoderInitializationException) cause;
//				if (decoderInitializationException.decoderName == null) {
//					if (decoderInitializationException.getCause() instanceof DecoderQueryException) {
//						errorString = getString(R.string.error_querying_decoders);
//					} else if (decoderInitializationException.secureDecoderRequired) {
//						errorString = getString(R.string.error_no_secure_decoder,
//												decoderInitializationException.mimeType);
//					} else {
//						errorString = getString(R.string.error_no_decoder,
//												decoderInitializationException.mimeType);
//					}
//				} else {
//					errorString = getString(R.string.error_instantiating_decoder,
//											decoderInitializationException.decoderName);
//				}
//			}
//		}
//		if (errorString != null) {
//			showToast(errorString);
//		}
//		needRetrySource = true;
//		if (isBehindLiveWindow(e)) {
//			clearResumePosition();
//			initializePlayer();
//		} else {
//			updateResumePosition();
//			updateButtonVisibilities();
//			showControls();
//		}
//	}
//
//	@Override
//	@SuppressWarnings("ReferenceEquality")
//	public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
//		updateButtonVisibilities();
//		if (trackGroups != lastSeenTrackGroupArray) {
//			MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
//			if (mappedTrackInfo != null) {
//				if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_VIDEO)
//					== MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
//					showToast(R.string.error_unsupported_video);
//				}
//				if (mappedTrackInfo.getTrackTypeRendererSupport(C.TRACK_TYPE_AUDIO)
//					== MappedTrackInfo.RENDERER_SUPPORT_UNSUPPORTED_TRACKS) {
//					showToast(R.string.error_unsupported_audio);
//				}
//			}
//			lastSeenTrackGroupArray = trackGroups;
//		}
//	}
//
//	// User controls
//
//	private void updateButtonVisibilities() {
//		debugRootView.removeAllViews();
//
//		retryButton.setVisibility(needRetrySource ? View.VISIBLE : View.GONE);
//		debugRootView.addView(retryButton);
//
//		if (player == null) {
//			return;
//		}
//
//		MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
//		if (mappedTrackInfo == null) {
//			return;
//		}
//
//		for (int i = 0; i < mappedTrackInfo.length; i++) {
//			TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(i);
//			if (trackGroups.length != 0) {
//				Button button = new Button(fragActivity);
//				int label;
//				switch (player.getRendererType(i)) {
//					case C.TRACK_TYPE_AUDIO:
//						label = R.string.audio;
//						break;
//					case C.TRACK_TYPE_VIDEO:
//						label = R.string.video;
//						break;
//					case C.TRACK_TYPE_TEXT:
//						label = R.string.text;
//						break;
//					default:
//						continue;
//				}
//				button.setText(label);
//				button.setTag(i);
//				button.setOnClickListener(this);
//				debugRootView.addView(button, debugRootView.getChildCount() - 1);
//			}
//		}
//	}
//
//	private void showControls() {
//		debugRootView.setVisibility(View.VISIBLE);
//	}
//
//	private void showToast(int messageId) {
//		showToast(getString(messageId));
//	}
//
//	private void showToast(String message) {
//		Toast.makeText(fragActivity.getApplicationContext(), message, Toast.LENGTH_LONG).show();
//	}
//
//	private static boolean isBehindLiveWindow(ExoPlaybackException e) {
//		if (e.type != ExoPlaybackException.TYPE_SOURCE) {
//			return false;
//		}
//		Throwable cause = e.getSourceException();
//		while (cause != null) {
//			if (cause instanceof BehindLiveWindowException) {
//				return true;
//			}
//			cause = cause.getCause();
//		}
//		return false;
//	}
//
//}
