40 | *
41 | * Note: VideoView does not retain its full state when going into the 42 | * background. In particular, it does not restore the current play state, 43 | * play position, selected tracks added via 44 | * {@link android.app.Activity#onSaveInstanceState} and 45 | * {@link android.app.Activity#onRestoreInstanceState}.
46 | * Also note that the audio session id (from {@link #getAudioSessionId}) may
47 | * change from its previously returned value when the VideoView is restored.
48 | */
49 |
50 | public class FensterVideoView extends TextureView implements MediaController.MediaPlayerControl, FensterPlayer {
51 |
52 | public static final String TAG = "TextureVideoView";
53 | public static final int VIDEO_BEGINNING = 0;
54 |
55 | public enum ScaleType {
56 | SCALE_TO_FIT, CROP
57 | }
58 |
59 | // all possible internal states
60 | private static final int STATE_ERROR = -1;
61 | private static final int STATE_IDLE = 0;
62 | private static final int STATE_PREPARING = 1;
63 | private static final int STATE_PREPARED = 2;
64 | private static final int STATE_PLAYING = 3;
65 | private static final int STATE_PAUSED = 4;
66 | private static final int STATE_PLAYBACK_COMPLETED = 5;
67 | private static final int MILLIS_IN_SEC = 1000;
68 |
69 | // collaborators / delegates / composites .. discuss
70 | private final VideoSizeCalculator videoSizeCalculator;
71 | // mCurrentState is a VideoView object's current state.
72 | // mTargetState is the state that a method caller intends to reach.
73 | // For instance, regardless the VideoView object's current state,
74 | // calling pause() intends to bring the object to a target state
75 | // of STATE_PAUSED.
76 | private int mCurrentState = STATE_IDLE;
77 | private int mTargetState = STATE_IDLE;
78 |
79 | private ScaleType mScaleType;
80 |
81 | private Uri mUri;
82 |
83 | private AssetFileDescriptor mAssetFileDescriptor;
84 | private Map