-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(android): update UI controller according to media3 #3914
base: master
Are you sure you want to change the base?
chore(android): update UI controller according to media3 #3914
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you didn't merge conflicts correctly (around drm props and allowchunklesspreparation. Can you please check that ?
I would like to test it afterward
Hi @seyedmostafahasani. Can you also add a screenshot of the new UI here? I would like to see what it looks like now ) |
@bulkinav thanks for your suggestion. I think it is better to implement the basics of the UI first, then we can implement the screenshot feature in the future in a new PR. |
@freeboub I think we can remove the |
android/src/main/java/com/brentvatne/exoplayer/FullScreenPlayerView.java
Outdated
Show resolved
Hide resolved
@freeboub, if everything works correctly, please don’t merge this branch to master yet. First, let me remove the additional code, then we can merge this branch to master. |
@freeboub, did you have enough time to test this PR? |
I've tried this version of UI with a video that has captions and multiple audio options Does the new UI have the ability to show a textTracks selection menu? I could not see a way to turn on / off captions The audio selection menu also appears buggy, as it repeats the options twice |
@ashnfb Yeah, it's possible to show the caption button in the new UI. I added it. Please check it out. |
@ashnfb regarding the audio selection menu, I think this URL has an issue: |
Just tested, I found 2 issues fo now:
|
# Conflicts: # android/src/main/java/com/brentvatne/exoplayer/AudioOutput.java # android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java # android/src/main/java/com/brentvatne/exoplayer/FullScreenPlayerView.java # android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java # android/src/main/java/com/brentvatne/react/VideoManagerModule.kt # src/specs/VideoNativeComponent.ts
@freeboub @KrzysztofMoch @YangJonghun I have updated the code. Please check it out. I think if we merge it, we can close some issues like (#4019, #3301,#3232,#2599) |
android/src/main/java/com/brentvatne/exoplayer/AudioOutput.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java
Outdated
Show resolved
Hide resolved
@@ -32,18 +29,15 @@ | |||
|
|||
import java.util.List; | |||
|
|||
@SuppressLint("ViewConstructor") | |||
public final class ExoPlayerView extends FrameLayout implements AdViewProvider { | |||
public final class ExoPlayerView extends PlayerView implements AdViewProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PlayerView already implements AdViewProvider internally
fyi) https://developer.android.com/reference/androidx/media3/ui/PlayerView
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sharing your knowledge.
override fun onBackPressed() { | ||
super.onBackPressed() | ||
findViewById<ImageView>(androidx.media3.ui.R.id.exo_fullscreen)?.performClick() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we need it because when a user presses the back button, the full-screen button icon doesn't change. We have to add it to update the full-screen button icon.
} | ||
|
||
override fun onStart() { | ||
super.onStart() | ||
parent = exoPlayerView.parent as ViewGroup? | ||
parent = exoPlayerView.parent as FrameLayout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to keep the ViewGroup?
if you possible🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have empty file here
} | ||
} catch (ex: Exception) { | ||
DebugLog.e("ExoPlayer Exception", "Failed to flag FLAG_KEEP_SCREEN_ON on fullscreen.") | ||
DebugLog.e("ExoPlayer Exception", "Failed to flag FLAG_KEEP_SCREEN_ON on fullscreeen.") |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -281,7 +255,7 @@ public void onVideoSizeChanged(VideoSize videoSize) { | |||
|
|||
@Override | |||
public void onRenderedFirstFrame() { | |||
shutterView.setVisibility(INVISIBLE); | |||
setHideShutterView(hideShutterView); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
} | ||
|
||
public void invalidateAspectRatio() { | ||
// Resetting aspect ratio will force layout refresh on next video size changed | ||
layout.invalidateAspectRatio(); | ||
//layout.invalidateAspectRatio(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intended?
layoutParams = new ViewGroup.LayoutParams( | ||
ViewGroup.LayoutParams.MATCH_PARENT, | ||
ViewGroup.LayoutParams.MATCH_PARENT); | ||
|
||
componentListener = new ComponentListener(); | ||
|
||
FrameLayout.LayoutParams aspectRatioParams = new FrameLayout.LayoutParams( | ||
FrameLayout.LayoutParams.MATCH_PARENT, | ||
FrameLayout.LayoutParams.MATCH_PARENT); | ||
aspectRatioParams.gravity = Gravity.CENTER; | ||
layout = new AspectRatioFrameLayout(context); | ||
layout.setLayoutParams(aspectRatioParams); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that layout is created but not included in the PlayerView. Am I misread something?
if (window != null) { | ||
val isPlaying = fullscreenVideoPlayer.exoPlayerView.isPlaying | ||
val isPlaying = it.exoPlayerView.isPlaying |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it retrun boolean? If it doesn't, PR#3969 has same problem also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it returns a boolean.
# Conflicts: # android/src/main/java/com/brentvatne/exoplayer/FullScreenPlayerView.kt
@YangJonghun thank you for reviewing my PR. I've applied your suggestions. |
@seyedmostafahasani |
@YangJonghun thanks for testing. I've fixed it. You can test it now. |
@seyedmostafahasani |
No problem. Thanks again for testing. Let me check it out. Are you sure this issue is related to this PR? |
Oops, it wasn't problem with this PR 😓 Also occurs on master branch |
No problem:). I will try to fix it in another PR. |
Summary
Upgrade player UI to align with media3 demo app
Motivation
Using the native controller to close these issues. (#4019, #3301,#3232,#2599)
Changes
Test plan