1# ExoPlayer SurfaceControl demo 2 3This app demonstrates how to use the [SurfaceControl][] API to redirect video 4output from ExoPlayer between different views or off-screen. `SurfaceControl` 5is new in Android 10, so the app requires `minSdkVersion` 29. 6 7The app layout has a grid of `SurfaceViews`. Initially video is output to one 8of the views. Tap a `SurfaceView` to move video output to it. You can also tap 9the buttons at the top of the activity to move video output off-screen, to a 10full-screen `SurfaceView` or to a new activity. 11 12When using `SurfaceControl`, the `MediaCodec` always has the same surface 13attached to it, which can be freely 'reparented' to any `SurfaceView` (or 14off-screen) without any interruptions to playback. This works better than 15calling `MediaCodec.setOutputSurface` to change the output surface of the codec 16because `MediaCodec` does not re-render its last frame when that method is 17called, and because you can move output off-screen easily (`setOutputSurface` 18can't take a `null` surface, so the player has to use a `DummySurface`, which 19doesn't handle protected output on all devices). 20 21[SurfaceControl]: https://developer.android.com/reference/android/view/SurfaceControl 22