*
* Note: VideoView does not retain its full state when going into the * background. In particular, it does not restore the current play state, * play position, selected tracks added via * {@link android.app.Activity#onSaveInstanceState} and * {@link android.app.Activity#onRestoreInstanceState}.
* Also note that the audio session id (from {@link #getAudioSessionId}) may
* change from its previously returned value when the VideoView is restored.
*/
public class FensterVideoView extends TextureView implements MediaController.MediaPlayerControl, FensterPlayer {
public static final String TAG = "TextureVideoView";
public static final int VIDEO_BEGINNING = 0;
public enum ScaleType {
SCALE_TO_FIT, CROP
}
// all possible internal states
private static final int STATE_ERROR = -1;
private static final int STATE_IDLE = 0;
private static final int STATE_PREPARING = 1;
private static final int STATE_PREPARED = 2;
private static final int STATE_PLAYING = 3;
private static final int STATE_PAUSED = 4;
private static final int STATE_PLAYBACK_COMPLETED = 5;
private static final int MILLIS_IN_SEC = 1000;
// collaborators / delegates / composites .. discuss
private final VideoSizeCalculator videoSizeCalculator;
// mCurrentState is a VideoView object's current state.
// mTargetState is the state that a method caller intends to reach.
// For instance, regardless the VideoView object's current state,
// calling pause() intends to bring the object to a target state
// of STATE_PAUSED.
private int mCurrentState = STATE_IDLE;
private int mTargetState = STATE_IDLE;
private ScaleType mScaleType;
private Uri mUri;
private AssetFileDescriptor mAssetFileDescriptor;
private Map