blob: 8650c0a0521c8efd066e45fc807c4d04a33a688a [file] [log] [blame]
Sungsoo Lime3259042018-01-16 09:25:28 +09001/*
2 * Copyright 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.widget;
18
19import android.annotation.IntDef;
20import android.annotation.NonNull;
21import android.annotation.Nullable;
22import android.content.Context;
Sungsoo Lime3259042018-01-16 09:25:28 +090023import android.media.AudioAttributes;
Insun Kangde16c4d2018-01-17 23:06:18 +090024import android.media.AudioManager;
Sungsoo Limaf2a1ad2018-01-24 11:36:10 +090025import android.media.MediaPlayerBase;
Sungsoo Lime3259042018-01-16 09:25:28 +090026import android.media.update.ApiLoader;
27import android.media.update.VideoView2Provider;
28import android.media.update.ViewProvider;
29import android.net.Uri;
30import android.util.AttributeSet;
31import android.view.KeyEvent;
32import android.view.MotionEvent;
33
34import java.lang.annotation.Retention;
35import java.lang.annotation.RetentionPolicy;
Sungsoo Limaf2a1ad2018-01-24 11:36:10 +090036import java.util.List;
Sungsoo Lime3259042018-01-16 09:25:28 +090037import java.util.Map;
38
Insun Kangeb78d512018-01-22 18:04:07 +090039// TODO: Use @link tag to refer MediaPlayer2 in docs once MediaPlayer2.java is submitted. Same to
40// MediaSession2.
41// TODO: change the reference from MediaPlayer to MediaPlayer2.
Sungsoo Lime3259042018-01-16 09:25:28 +090042/**
Insun Kangeb78d512018-01-22 18:04:07 +090043 * Displays a video file. VideoView2 class is a View class which is wrapping MediaPlayer2 so that
44 * developers can easily implement a video rendering application.
45 *
46 * <p>
47 * <em> Data sources that VideoView2 supports : </em>
48 * VideoView2 can play video files and audio-only fiels as
49 * well. It can load from various sources such as resources or content providers. The supported
50 * media file formats are the same as MediaPlayer2.
51 *
52 * <p>
53 * <em> View type can be selected : </em>
54 * VideoView2 can render videos on top of TextureView as well as
55 * SurfaceView selectively. The default is SurfaceView and it can be changed using
56 * {@link #setViewType(int)} method. Using SurfaceView is recommended in most cases for saving
57 * battery. TextureView might be preferred for supporting various UIs such as animation and
58 * translucency.
59 *
60 * <p>
61 * <em> Differences between {@link VideoView} class : </em>
62 * VideoView2 covers and inherits the most of
63 * VideoView's functionalities. The main differences are
64 * <ul>
65 * <li> VideoView2 inherits FrameLayout and renders videos using SurfaceView and TextureView
66 * selectively while VideoView inherits SurfaceView class.
67 * <li> VideoView2 is integrated with MediaControlView2 and a default MediaControlView2 instance is
68 * attached to VideoView2 by default. If a developer does not want to use the default
69 * MediaControlView2, needs to set enableControlView attribute to false. For instance,
70 * <pre>
71 * &lt;VideoView2
72 * android:id="@+id/video_view"
73 * xmlns:widget="http://schemas.android.com/apk/com.android.media.update"
74 * widget:enableControlView="false" /&gt;
75 * </pre>
76 * If a developer wants to attach a customed MediaControlView2, then set enableControlView attribute
77 * to false and assign the customed media control widget using {@link #setMediaControlView2}.
78 * <li> VideoView2 is integrated with MediaPlayer2 while VideoView is integrated with MediaPlayer.
79 * <li> VideoView2 is integrated with MediaSession2 and so it responses with media key events.
80 * A VideoView2 keeps a MediaSession2 instance internally and connects it to a corresponding
81 * MediaControlView2 instance.
82 * </p>
83 * </ul>
84 *
85 * <p>
86 * <em> Audio focus and audio attributes : </em>
87 * By default, VideoView2 requests audio focus with
88 * {@link AudioManager#AUDIOFOCUS_GAIN}. Use {@link #setAudioFocusRequest(int)} to change this
89 * behavior. The default {@link AudioAttributes} used during playback have a usage of
90 * {@link AudioAttributes#USAGE_MEDIA} and a content type of
91 * {@link AudioAttributes#CONTENT_TYPE_MOVIE}, use {@link #setAudioAttributes(AudioAttributes)} to
92 * modify them.
93 *
94 * <p>
95 * Note: VideoView2 does not retain its full state when going into the background. In particular, it
96 * does not restore the current play state, play position, selected tracks. Applications should save
97 * and restore these on their own in {@link android.app.Activity#onSaveInstanceState} and
98 * {@link android.app.Activity#onRestoreInstanceState}.
99 *
Sungsoo Lime3259042018-01-16 09:25:28 +0900100 * @hide
101 */
102public class VideoView2 extends FrameLayout {
Insun Kangeb78d512018-01-22 18:04:07 +0900103 /** @hide */
Sungsoo Lime3259042018-01-16 09:25:28 +0900104 @IntDef({
105 VIEW_TYPE_TEXTUREVIEW,
106 VIEW_TYPE_SURFACEVIEW
107 })
108 @Retention(RetentionPolicy.SOURCE)
109 public @interface ViewType {}
Insun Kangeb78d512018-01-22 18:04:07 +0900110
Sungsoo Lime3259042018-01-16 09:25:28 +0900111 public static final int VIEW_TYPE_SURFACEVIEW = 1;
112 public static final int VIEW_TYPE_TEXTUREVIEW = 2;
113
114 private final VideoView2Provider mProvider;
115
Sungsoo Lime3259042018-01-16 09:25:28 +0900116 public VideoView2(@NonNull Context context) {
117 this(context, null);
118 }
119
Sungsoo Lime3259042018-01-16 09:25:28 +0900120 public VideoView2(@NonNull Context context, @Nullable AttributeSet attrs) {
121 this(context, attrs, 0);
122 }
123
Sungsoo Lime3259042018-01-16 09:25:28 +0900124 public VideoView2(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
125 this(context, attrs, defStyleAttr, 0);
126 }
127
Sungsoo Lime3259042018-01-16 09:25:28 +0900128 public VideoView2(
129 @NonNull Context context, @Nullable AttributeSet attrs,
130 int defStyleAttr, int defStyleRes) {
131 super(context, attrs, defStyleAttr, defStyleRes);
132
Insun Kangde16c4d2018-01-17 23:06:18 +0900133 mProvider = ApiLoader.getProvider(context).createVideoView2(this, new SuperProvider(),
134 attrs, defStyleAttr, defStyleRes);
Sungsoo Lime3259042018-01-16 09:25:28 +0900135 }
136
137 /**
138 * @hide
139 */
140 public VideoView2Provider getProvider() {
141 return mProvider;
142 }
143
144 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900145 * Sets MediaControlView2 instance. It will replace the previously assigned MediaControlView2
146 * instance if any.
147 *
148 * @param mediaControlView a media control view2 instance.
Sungsoo Lime3259042018-01-16 09:25:28 +0900149 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900150 public void setMediaControlView2(MediaControlView2 mediaControlView) {
151 mProvider.setMediaControlView2_impl(mediaControlView);
152 }
153
154 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900155 * Returns MediaControlView2 instance which is currently attached to VideoView2 by default or by
156 * {@link #setMediaControlView2} method.
Insun Kangde16c4d2018-01-17 23:06:18 +0900157 */
158 public MediaControlView2 getMediaControlView2() {
159 return mProvider.getMediaControlView2_impl();
160 }
161
162 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900163 * Starts playback with the media contents specified by {@link #setVideoURI} and
164 * {@link #setVideoPath}.
165 * If it has been paused, this method will resume playback from the current position.
Insun Kangde16c4d2018-01-17 23:06:18 +0900166 */
Sungsoo Lime3259042018-01-16 09:25:28 +0900167 public void start() {
168 mProvider.start_impl();
169 }
170
171 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900172 * Pauses playback.
Sungsoo Lime3259042018-01-16 09:25:28 +0900173 */
174 public void pause() {
175 mProvider.pause_impl();
176 }
177
178 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900179 * Gets the duration of the media content specified by #setVideoURI and #setVideoPath
180 * in milliseconds.
Sungsoo Lime3259042018-01-16 09:25:28 +0900181 */
182 public int getDuration() {
183 return mProvider.getDuration_impl();
184 }
185
186 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900187 * Gets current playback position in milliseconds.
Sungsoo Lime3259042018-01-16 09:25:28 +0900188 */
189 public int getCurrentPosition() {
190 return mProvider.getCurrentPosition_impl();
191 }
192
Insun Kangeb78d512018-01-22 18:04:07 +0900193 // TODO: mention about key-frame related behavior.
Sungsoo Lime3259042018-01-16 09:25:28 +0900194 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900195 * Moves the media by specified time position.
196 * @param msec the offset in milliseconds from the start to seek to.
Sungsoo Lime3259042018-01-16 09:25:28 +0900197 */
198 public void seekTo(int msec) {
199 mProvider.seekTo_impl(msec);
200 }
201
202 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900203 * Says if the media is currently playing.
204 * @return true if the media is playing, false if it is not (eg. paused or stopped).
Sungsoo Lime3259042018-01-16 09:25:28 +0900205 */
206 public boolean isPlaying() {
207 return mProvider.isPlaying_impl();
208 }
209
Insun Kangeb78d512018-01-22 18:04:07 +0900210 // TODO: check what will return if it is a local media.
Sungsoo Lime3259042018-01-16 09:25:28 +0900211 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900212 * Gets the percentage (0-100) of the content that has been buffered or played so far.
Sungsoo Lime3259042018-01-16 09:25:28 +0900213 */
214 public int getBufferPercentage() {
215 return mProvider.getBufferPercentage_impl();
216 }
217
218 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900219 * Returns the audio session ID.
Sungsoo Lime3259042018-01-16 09:25:28 +0900220 */
221 public int getAudioSessionId() {
222 return mProvider.getAudioSessionId_impl();
223 }
224
225 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900226 * Starts rendering closed caption or subtitles if there is any. The first subtitle track will
227 * be chosen by default if there multiple subtitle tracks exist.
Sungsoo Lime3259042018-01-16 09:25:28 +0900228 */
229 public void showSubtitle() {
230 mProvider.showSubtitle_impl();
231 }
232
233 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900234 * Stops showing closed captions or subtitles.
Sungsoo Lime3259042018-01-16 09:25:28 +0900235 */
236 public void hideSubtitle() {
237 mProvider.hideSubtitle_impl();
238 }
239
Hyundo Moonefeb45e2018-01-24 11:16:19 +0900240 /**
241 * Sets full screen mode.
242 */
243 public void setFullScreen(boolean fullScreen) {
244 mProvider.setFullScreen_impl(fullScreen);
245 }
246
Insun Kangeb78d512018-01-22 18:04:07 +0900247 // TODO: This should be revised after integration with MediaPlayer2.
Sungsoo Lime3259042018-01-16 09:25:28 +0900248 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900249 * Sets playback speed.
250 *
251 * It is expressed as a multiplicative factor, where normal speed is 1.0f. If it is less than
252 * or equal to zero, it will be just ignored and nothing will be changed. If it exceeds the
253 * maximum speed that internal engine supports, system will determine best handling or it will
254 * be reset to the normal speed 1.0f.
Insun Kangde16c4d2018-01-17 23:06:18 +0900255 * @param speed the playback speed. It should be positive.
Insun Kangde16c4d2018-01-17 23:06:18 +0900256 */
257 public void setSpeed(float speed) {
258 mProvider.setSpeed_impl(speed);
259 }
260
261 /**
262 * Returns current speed setting.
263 *
264 * If setSpeed() has never been called, returns the default value 1.0f.
265 * @return current speed setting
Insun Kangde16c4d2018-01-17 23:06:18 +0900266 */
267 public float getSpeed() {
268 return mProvider.getSpeed_impl();
269 }
270
271 /**
272 * Sets which type of audio focus will be requested during the playback, or configures playback
273 * to not request audio focus. Valid values for focus requests are
274 * {@link AudioManager#AUDIOFOCUS_GAIN}, {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT},
275 * {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK}, and
276 * {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE}. Or use
277 * {@link AudioManager#AUDIOFOCUS_NONE} to express that audio focus should not be
278 * requested when playback starts. You can for instance use this when playing a silent animation
279 * through this class, and you don't want to affect other audio applications playing in the
280 * background.
281 *
282 * @param focusGain the type of audio focus gain that will be requested, or
Sungsoo Limaf2a1ad2018-01-24 11:36:10 +0900283 * {@link AudioManager#AUDIOFOCUS_NONE} to disable the use audio focus during
284 * playback.
Sungsoo Lime3259042018-01-16 09:25:28 +0900285 */
286 public void setAudioFocusRequest(int focusGain) {
287 mProvider.setAudioFocusRequest_impl(focusGain);
288 }
289
290 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900291 * Sets the {@link AudioAttributes} to be used during the playback of the video.
292 *
293 * @param attributes non-null <code>AudioAttributes</code>.
Sungsoo Lime3259042018-01-16 09:25:28 +0900294 */
295 public void setAudioAttributes(@NonNull AudioAttributes attributes) {
296 mProvider.setAudioAttributes_impl(attributes);
297 }
298
299 /**
Sungsoo Limaf2a1ad2018-01-24 11:36:10 +0900300 * Sets a remote player for handling playback of the selected route from MediaControlView2.
301 * If this is not called, MediaCotrolView2 will not show the route button.
302 *
303 * @param routeCategories the list of media control categories in
304 * {@link android.support.v7.media.MediaControlIntent}
305 * @param player the player to handle the selected route. If null, a default
306 * route player will be used.
307 * @throws IllegalStateException if MediaControlView2 is not set.
308 */
309 public void setRouteAttributes(@NonNull List<String> routeCategories,
310 @Nullable MediaPlayerBase player) {
311 mProvider.setRouteAttributes_impl(routeCategories, player);
312 }
313
314 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900315 * Sets video path.
316 *
317 * @param path the path of the video.
Sungsoo Lime3259042018-01-16 09:25:28 +0900318 */
319 public void setVideoPath(String path) {
320 mProvider.setVideoPath_impl(path);
321 }
322
323 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900324 * Sets video URI.
325 *
326 * @param uri the URI of the video.
Sungsoo Lime3259042018-01-16 09:25:28 +0900327 */
328 public void setVideoURI(Uri uri) {
329 mProvider.setVideoURI_impl(uri);
330 }
331
332 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900333 * Sets video URI using specific headers.
334 *
335 * @param uri the URI of the video.
336 * @param headers the headers for the URI request.
337 * Note that the cross domain redirection is allowed by default, but that can be
338 * changed with key/value pairs through the headers parameter with
339 * "android-allow-cross-domain-redirect" as the key and "0" or "1" as the value
340 * to disallow or allow cross domain redirection.
Sungsoo Lime3259042018-01-16 09:25:28 +0900341 */
342 public void setVideoURI(Uri uri, Map<String, String> headers) {
343 mProvider.setVideoURI_impl(uri, headers);
344 }
345
346 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900347 * Selects which view will be used to render video between SurfacView and TextureView.
348 *
349 * @param viewType the view type to render video
350 * <ul>
351 * <li>{@link #VIEW_TYPE_SURFACEVIEW}
352 * <li>{@link #VIEW_TYPE_TEXTUREVIEW}
353 * </ul>
Sungsoo Lime3259042018-01-16 09:25:28 +0900354 */
Sungsoo Lime3259042018-01-16 09:25:28 +0900355 public void setViewType(@ViewType int viewType) {
356 mProvider.setViewType_impl(viewType);
357 }
358
359 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900360 * Returns view type.
361 *
362 * @return view type. See {@see setViewType}.
Sungsoo Lime3259042018-01-16 09:25:28 +0900363 */
364 @ViewType
365 public int getViewType() {
366 return mProvider.getViewType_impl();
367 }
368
369 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900370 * Stops playback and release all the resources. This should be called whenever a VideoView2
371 * instance is no longer to be used.
Sungsoo Lime3259042018-01-16 09:25:28 +0900372 */
373 public void stopPlayback() {
374 mProvider.stopPlayback_impl();
375 }
376
377 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900378 * Registers a callback to be invoked when the media file is loaded and ready to go.
379 *
380 * @param l the callback that will be run.
Sungsoo Lime3259042018-01-16 09:25:28 +0900381 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900382 public void setOnPreparedListener(OnPreparedListener l) {
Sungsoo Lime3259042018-01-16 09:25:28 +0900383 mProvider.setOnPreparedListener_impl(l);
384 }
385
386 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900387 * Registers a callback to be invoked when the end of a media file has been reached during
388 * playback.
389 *
390 * @param l the callback that will be run.
Sungsoo Lime3259042018-01-16 09:25:28 +0900391 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900392 public void setOnCompletionListener(OnCompletionListener l) {
Sungsoo Lime3259042018-01-16 09:25:28 +0900393 mProvider.setOnCompletionListener_impl(l);
394 }
395
396 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900397 * Registers a callback to be invoked when an error occurs during playback or setup. If no
398 * listener is specified, or if the listener returned false, VideoView2 will inform the user of
399 * any errors.
400 *
401 * @param l The callback that will be run
Sungsoo Lime3259042018-01-16 09:25:28 +0900402 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900403 public void setOnErrorListener(OnErrorListener l) {
Sungsoo Lime3259042018-01-16 09:25:28 +0900404 mProvider.setOnErrorListener_impl(l);
405 }
406
407 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900408 * Registers a callback to be invoked when an informational event occurs during playback or
409 * setup.
410 *
411 * @param l The callback that will be run
Sungsoo Lime3259042018-01-16 09:25:28 +0900412 */
Insun Kangde16c4d2018-01-17 23:06:18 +0900413 public void setOnInfoListener(OnInfoListener l) {
Sungsoo Lime3259042018-01-16 09:25:28 +0900414 mProvider.setOnInfoListener_impl(l);
415 }
416
417 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900418 * Registers a callback to be invoked when a view type change is done.
419 * {@see #setViewType(int)}
420 * @param l The callback that will be run
Sungsoo Lime3259042018-01-16 09:25:28 +0900421 */
422 public void setOnViewTypeChangedListener(OnViewTypeChangedListener l) {
423 mProvider.setOnViewTypeChangedListener_impl(l);
424 }
425
426 /**
Hyundo Moonefeb45e2018-01-24 11:16:19 +0900427 * Registers a callback to be invoked when the fullscreen mode should be changed.
428 */
429 public void setFullScreenChangedListener(OnFullScreenChangedListener l) {
430 mProvider.setFullScreenChangedListener_impl(l);
431 }
432
433 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900434 * Interface definition of a callback to be invoked when the viw type has been changed.
Sungsoo Lime3259042018-01-16 09:25:28 +0900435 */
436 public interface OnViewTypeChangedListener {
437 /**
Insun Kangde16c4d2018-01-17 23:06:18 +0900438 * Called when the view type has been changed.
Insun Kangeb78d512018-01-22 18:04:07 +0900439 * @see #setViewType(int)
440 * @param viewType
441 * <ul>
442 * <li>{@link #VIEW_TYPE_SURFACEVIEW}
443 * <li>{@link #VIEW_TYPE_TEXTUREVIEW}
444 * </ul>
Sungsoo Lime3259042018-01-16 09:25:28 +0900445 */
446 void onViewTypeChanged(@ViewType int viewType);
447 }
448
Insun Kangde16c4d2018-01-17 23:06:18 +0900449 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900450 * Interface definition of a callback to be invoked when the media source is ready for playback.
Insun Kangde16c4d2018-01-17 23:06:18 +0900451 */
452 public interface OnPreparedListener {
453 /**
454 * Called when the media file is ready for playback.
455 */
456 void onPrepared();
457 }
458
459 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900460 * Interface definition for a callback to be invoked when playback of a media source has
461 * completed.
Insun Kangde16c4d2018-01-17 23:06:18 +0900462 */
463 public interface OnCompletionListener {
464 /**
465 * Called when the end of a media source is reached during playback.
466 */
467 void onCompletion();
468 }
469
470 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900471 * Interface definition of a callback to be invoked when there has been an error during an
472 * asynchronous operation.
Insun Kangde16c4d2018-01-17 23:06:18 +0900473 */
474 public interface OnErrorListener {
Insun Kangeb78d512018-01-22 18:04:07 +0900475 // TODO: Redefine error codes.
Insun Kangde16c4d2018-01-17 23:06:18 +0900476 /**
477 * Called to indicate an error.
Insun Kangeb78d512018-01-22 18:04:07 +0900478 * @param what the type of error that has occurred
479 * @param extra an extra code, specific to the error.
480 * @return true if the method handled the error, false if it didn't.
481 * @see MediaPlayer#OnErrorListener
Insun Kangde16c4d2018-01-17 23:06:18 +0900482 */
483 boolean onError(int what, int extra);
484 }
485
486 /**
Insun Kangeb78d512018-01-22 18:04:07 +0900487 * Interface definition of a callback to be invoked to communicate some info and/or warning
488 * about the media or its playback.
Insun Kangde16c4d2018-01-17 23:06:18 +0900489 */
490 public interface OnInfoListener {
491 /**
492 * Called to indicate an info or a warning.
Insun Kangde16c4d2018-01-17 23:06:18 +0900493 * @param what the type of info or warning.
494 * @param extra an extra code, specific to the info.
Insun Kangeb78d512018-01-22 18:04:07 +0900495 *
496 * @see MediaPlayer#OnInfoListener
Insun Kangde16c4d2018-01-17 23:06:18 +0900497 */
498 void onInfo(int what, int extra);
499 }
500
Hyundo Moonefeb45e2018-01-24 11:16:19 +0900501 /**
502 * Interface definition of a callback to be invoked to inform the fullscreen mode is changed.
503 */
504 public interface OnFullScreenChangedListener {
505 /**
506 * Called to indicate a fullscreen mode change.
507 */
508 void onFullScreenChanged(boolean fullScreen);
509 }
510
Sungsoo Lime3259042018-01-16 09:25:28 +0900511 @Override
Insun Kangfd3fdfd2018-01-23 15:01:37 +0900512 protected void onAttachedToWindow() {
513 mProvider.onAttachedToWindow_impl();
514 }
515
516 @Override
517 protected void onDetachedFromWindow() {
518 mProvider.onDetachedFromWindow_impl();
519 }
520
521 @Override
Sungsoo Lime3259042018-01-16 09:25:28 +0900522 public CharSequence getAccessibilityClassName() {
523 return mProvider.getAccessibilityClassName_impl();
524 }
525
526 @Override
527 public boolean onTouchEvent(MotionEvent ev) {
528 return mProvider.onTouchEvent_impl(ev);
529 }
530
531 @Override
532 public boolean onTrackballEvent(MotionEvent ev) {
533 return mProvider.onTrackballEvent_impl(ev);
534 }
535
536 @Override
537 public boolean onKeyDown(int keyCode, KeyEvent event) {
538 return mProvider.onKeyDown_impl(keyCode, event);
539 }
540
541 @Override
542 public void onFinishInflate() {
543 mProvider.onFinishInflate_impl();
544 }
545
546 @Override
547 public boolean dispatchKeyEvent(KeyEvent event) {
548 return mProvider.dispatchKeyEvent_impl(event);
549 }
550
551 @Override
552 public void setEnabled(boolean enabled) {
553 mProvider.setEnabled_impl(enabled);
554 }
555
556 private class SuperProvider implements ViewProvider {
557 @Override
Insun Kangfd3fdfd2018-01-23 15:01:37 +0900558 public void onAttachedToWindow_impl() {
559 VideoView2.super.onAttachedToWindow();
560 }
561
562 @Override
563 public void onDetachedFromWindow_impl() {
564 VideoView2.super.onDetachedFromWindow();
565 }
566
567 @Override
Sungsoo Lime3259042018-01-16 09:25:28 +0900568 public CharSequence getAccessibilityClassName_impl() {
569 return VideoView2.super.getAccessibilityClassName();
570 }
571
572 @Override
573 public boolean onTouchEvent_impl(MotionEvent ev) {
574 return VideoView2.super.onTouchEvent(ev);
575 }
576
577 @Override
578 public boolean onTrackballEvent_impl(MotionEvent ev) {
579 return VideoView2.super.onTrackballEvent(ev);
580 }
581
582 @Override
583 public boolean onKeyDown_impl(int keyCode, KeyEvent event) {
584 return VideoView2.super.onKeyDown(keyCode, event);
585 }
586
587 @Override
588 public void onFinishInflate_impl() {
589 VideoView2.super.onFinishInflate();
590 }
591
592 @Override
593 public boolean dispatchKeyEvent_impl(KeyEvent event) {
594 return VideoView2.super.dispatchKeyEvent(event);
595 }
596
597 @Override
598 public void setEnabled_impl(boolean enabled) {
599 VideoView2.super.setEnabled(enabled);
600 }
601 }
602}