Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
dd0981a5
authored
May 04, 2021
by
olly
Committed by
bachinger
May 04, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Access ExoPlayer specific UI components via reflection
PiperOrigin-RevId: 371799441
parent
416bd435
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
14 deletions
library/ui/proguard-rules.txt
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java
library/ui/proguard-rules.txt
View file @
dd0981a5
# Proguard rules specific to the UI module.
# Constructor method accessed via reflection in StyledPlayerView and PlayerView
-dontnote com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView
-keepclassmembers class com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView {
<init>(android.content.Context);
}
-dontnote com.google.android.exoplayer2.video.VideoDecoderGLSurfaceView
-keepclassmembers class com.google.android.exoplayer2.video.VideoDecoderGLSurfaceView {
<init>(android.content.Context);
}
# Constructor method accessed via reflection in TrackSelectionDialogBuilder
-dontnote androidx.appcompat.app.AlertDialog.Builder
-keepclassmembers class androidx.appcompat.app.AlertDialog$Builder {
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
View file @
dd0981a5
...
...
@@ -65,8 +65,6 @@ import com.google.android.exoplayer2.util.Assertions;
import
com.google.android.exoplayer2.util.ErrorMessageProvider
;
import
com.google.android.exoplayer2.util.RepeatModeUtil
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.video.VideoDecoderGLSurfaceView
;
import
com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView
;
import
com.google.common.collect.ImmutableList
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
...
...
@@ -420,11 +418,26 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
surfaceView
=
new
TextureView
(
context
);
break
;
case
SURFACE_TYPE_SPHERICAL_GL_SURFACE_VIEW:
surfaceView
=
new
SphericalGLSurfaceView
(
context
);
try
{
Class
<?>
clazz
=
Class
.
forName
(
"com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView"
);
surfaceView
=
(
View
)
clazz
.
getConstructor
(
Context
.
class
).
newInstance
(
context
);
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"spherical_gl_surface_view requires an ExoPlayer dependency"
,
e
);
}
surfaceViewIgnoresVideoAspectRatio
=
true
;
break
;
case
SURFACE_TYPE_VIDEO_DECODER_GL_SURFACE_VIEW:
surfaceView
=
new
VideoDecoderGLSurfaceView
(
context
);
try
{
Class
<?>
clazz
=
Class
.
forName
(
"com.google.android.exoplayer2.video.VideoDecoderGLSurfaceView"
);
surfaceView
=
(
View
)
clazz
.
getConstructor
(
Context
.
class
).
newInstance
(
context
);
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"video_decoder_gl_surface_view requires an ExoPlayer dependency"
,
e
);
}
break
;
default
:
surfaceView
=
new
SurfaceView
(
context
);
...
...
@@ -1049,14 +1062,14 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* <li>{@link SurfaceView} by default, or if the {@code surface_type} attribute is set to {@code
* surface_view}.
* <li>{@link TextureView} if {@code surface_type} is {@code texture_view}.
* <li>{@
link
SphericalGLSurfaceView} if {@code surface_type} is {@code
* <li>{@
code
SphericalGLSurfaceView} if {@code surface_type} is {@code
* spherical_gl_surface_view}.
* <li>{@
link
VideoDecoderGLSurfaceView} if {@code surface_type} is {@code
* <li>{@
code
VideoDecoderGLSurfaceView} if {@code surface_type} is {@code
* video_decoder_gl_surface_view}.
* <li>{@code null} if {@code surface_type} is {@code none}.
* </ul>
*
* @return The {@link SurfaceView}, {@link TextureView}, {@
link SphericalGLSurfaceView}, {@link
* @return The {@link SurfaceView}, {@link TextureView}, {@
code SphericalGLSurfaceView}, {@code
* VideoDecoderGLSurfaceView} or {@code null}.
*/
@Nullable
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java
View file @
dd0981a5
...
...
@@ -65,8 +65,6 @@ import com.google.android.exoplayer2.util.Assertions;
import
com.google.android.exoplayer2.util.ErrorMessageProvider
;
import
com.google.android.exoplayer2.util.RepeatModeUtil
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.video.VideoDecoderGLSurfaceView
;
import
com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView
;
import
com.google.common.collect.ImmutableList
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
...
...
@@ -425,11 +423,26 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
surfaceView
=
new
TextureView
(
context
);
break
;
case
SURFACE_TYPE_SPHERICAL_GL_SURFACE_VIEW:
surfaceView
=
new
SphericalGLSurfaceView
(
context
);
try
{
Class
<?>
clazz
=
Class
.
forName
(
"com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView"
);
surfaceView
=
(
View
)
clazz
.
getConstructor
(
Context
.
class
).
newInstance
(
context
);
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"spherical_gl_surface_view requires an ExoPlayer dependency"
,
e
);
}
surfaceViewIgnoresVideoAspectRatio
=
true
;
break
;
case
SURFACE_TYPE_VIDEO_DECODER_GL_SURFACE_VIEW:
surfaceView
=
new
VideoDecoderGLSurfaceView
(
context
);
try
{
Class
<?>
clazz
=
Class
.
forName
(
"com.google.android.exoplayer2.video.VideoDecoderGLSurfaceView"
);
surfaceView
=
(
View
)
clazz
.
getConstructor
(
Context
.
class
).
newInstance
(
context
);
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"video_decoder_gl_surface_view requires an ExoPlayer dependency"
,
e
);
}
break
;
default
:
surfaceView
=
new
SurfaceView
(
context
);
...
...
@@ -1063,14 +1076,14 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
* <li>{@link SurfaceView} by default, or if the {@code surface_type} attribute is set to {@code
* surface_view}.
* <li>{@link TextureView} if {@code surface_type} is {@code texture_view}.
* <li>{@
link
SphericalGLSurfaceView} if {@code surface_type} is {@code
* <li>{@
code
SphericalGLSurfaceView} if {@code surface_type} is {@code
* spherical_gl_surface_view}.
* <li>{@
link
VideoDecoderGLSurfaceView} if {@code surface_type} is {@code
* <li>{@
code
VideoDecoderGLSurfaceView} if {@code surface_type} is {@code
* video_decoder_gl_surface_view}.
* <li>{@code null} if {@code surface_type} is {@code none}.
* </ul>
*
* @return The {@link SurfaceView}, {@link TextureView}, {@
link SphericalGLSurfaceView}, {@link
* @return The {@link SurfaceView}, {@link TextureView}, {@
code SphericalGLSurfaceView}, {@code
* VideoDecoderGLSurfaceView} or {@code null}.
*/
@Nullable
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment