Skip to content
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

Open
wants to merge 39 commits into
base: master
Choose a base branch
from

Conversation

seyedmostafahasani
Copy link
Contributor

@seyedmostafahasani seyedmostafahasani commented Jun 14, 2024

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

@seyedmostafahasani seyedmostafahasani marked this pull request as draft June 15, 2024 06:20
Copy link
Collaborator

@freeboub freeboub left a 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

@bulkinav
Copy link

Hi @seyedmostafahasani. Can you also add a screenshot of the new UI here? I would like to see what it looks like now )

@seyedmostafahasani
Copy link
Contributor Author

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 what do you think?

@seyedmostafahasani
Copy link
Contributor Author

@freeboub I think we can remove the fullscreen prop in V7. The user can handle fullscreen mode with the setFullScreen method, so we don’t need an additional prop like fullscreen. What is your opinion?

@seyedmostafahasani seyedmostafahasani marked this pull request as ready for review June 16, 2024 23:00
@seyedmostafahasani
Copy link
Contributor Author

@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.

@seyedmostafahasani
Copy link
Contributor Author

@freeboub, did you have enough time to test this PR?

@ashnfb
Copy link
Contributor

ashnfb commented Jun 20, 2024

I've tried this version of UI with a video that has captions and multiple audio options
https://bitmovin-a.akamaihd.net/content/sintel/hls/playlist.m3u8

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

@seyedmostafahasani
Copy link
Contributor Author

seyedmostafahasani commented Jun 21, 2024

I've tried this version of UI with a video that has captions and multiple audio options https://bitmovin-a.akamaihd.net/content/sintel/hls/playlist.m3u8

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.

@seyedmostafahasani
Copy link
Contributor Author

seyedmostafahasani commented Jun 21, 2024

@ashnfb regarding the audio selection menu, I think this URL has an issue: https://bitmovin-a.akamaihd.net/content/sintel/hls/playlist.m3u8. I've tested it with other URLs, as shown below, and the audio menu works correctly.

  1. https://flipfit-cdn.akamaized.net/flip_hls/661f570aab9d840019942b80-473e0b/video_h1.m3u8
  2. https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_fmp4/master.m3u8
    What do you think?

@freeboub
Copy link
Collaborator

Just tested, I found 2 issues fo now:

  • in the sample app, the controls are displayed by default even if controls={false} by default
  • in the sample app, when I go to "no view" item and then channel up to 'another live sample', the video shows a big resizing glitch

# 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
@seyedmostafahasani
Copy link
Contributor Author

seyedmostafahasani commented Jul 21, 2024

@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)
I will be available to apply your comments on this PR.

@@ -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 {
Copy link
Collaborator

@YangJonghun YangJonghun Jul 22, 2024

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

Copy link
Contributor Author

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()
Copy link
Collaborator

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?

Copy link
Contributor Author

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
Copy link
Collaborator

@YangJonghun YangJonghun Jul 22, 2024

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🙏

Copy link
Collaborator

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.

@@ -281,7 +255,7 @@ public void onVideoSizeChanged(VideoSize videoSize) {

@Override
public void onRenderedFirstFrame() {
shutterView.setVisibility(INVISIBLE);
setHideShutterView(hideShutterView);

This comment was marked as resolved.

}

public void invalidateAspectRatio() {
// Resetting aspect ratio will force layout refresh on next video size changed
layout.invalidateAspectRatio();
//layout.invalidateAspectRatio();
Copy link
Collaborator

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);
Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Contributor Author

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
@seyedmostafahasani
Copy link
Contributor Author

@YangJonghun thank you for reviewing my PR. I've applied your suggestions.

@YangJonghun
Copy link
Collaborator

@seyedmostafahasani
Thanks
It seems resizeMode prop doesn't work in this PR, please check it🙏

@seyedmostafahasani
Copy link
Contributor Author

@YangJonghun thanks for testing. I've fixed it. You can test it now.

@YangJonghun
Copy link
Collaborator

@seyedmostafahasani
Thanks:)
But navigation bar does not work properly when restoring from fullscreen mode. Sorry for not commenting at once🥲
(If I find more issues after testing, I'll leave them in this comment.)

@seyedmostafahasani
Copy link
Contributor Author

@seyedmostafahasani Thanks:) But navigation bar does not work properly when restoring from fullscreen mode. Sorry for not commenting at once🥲 (If I find more issues after testing, I'll leave them in this comment.)

No problem. Thanks again for testing. Let me check it out. Are you sure this issue is related to this PR?

@YangJonghun
Copy link
Collaborator

YangJonghun commented Jul 29, 2024

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

@seyedmostafahasani
Copy link
Contributor Author

No problem:). I will try to fix it in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants