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: add setFullScreen to component's ref #3855

Merged

Conversation

seyedmostafahasani
Copy link
Collaborator

@seyedmostafahasani seyedmostafahasani commented May 29, 2024

…eenPlayer & dismissFullscreenPlayer

Summary

I added setFullScreen to handle fullScreen mode without controls.

Motivation

The user can use it to handle fullscreen mode with custom controls, specifically refactoring the codebase and fix this issue

Changes

I added a function called setFullScreen and deprecated the functions presentFullscreenPlayer and dismissFullscreenPlayer.

Test plan

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.

We cannot remove existing APIs on 6.X branch, I don't understand why you need this change. Can you please clarify ?

@seyedmostafahasani
Copy link
Collaborator Author

I think we can implement full-screen mode with just this function. We don't need two functions to handle it. Additionally, if we remove these functions, we will eliminate an unnecessary useState from the video component, which prevents re-rendering. Specifically, we will also fix another issue in the library, #3732. The main point is that we handle this logic with just one function. What is your opinion?

@seyedmostafahasani
Copy link
Collaborator Author

@freeboub what do you think about my points?

@freeboub
Copy link
Collaborator

@seyedmostafahasani We cannot change api on V6.X, if we integrate such api change, we will need to bump to V7 and all apps using the package will have to upgrade their integration. as the team have a lot of api changes in mind, we try to keep api interoperability as much as possible.

Here is a sample:
https://github.com/TheWidlarzGroup/react-native-video/pull/3867/files#diff-e2131d0631cdc1ddf0ba36827a27b86adf8e5b8ed162a280a53c6219f4df5a5f

I just move few props from the root of video to the source object, to avoid upgrade issue, I comment in doc that the old api is deprecated, and point to the new way to proceed.

It will allow easy upgrade for apps, we keep in mind that old api (deprecated) can be removed on V7.
Can you please do the same thing please ?
I think merging the 2 apis make sense, but we need to keep compatibility of old api some time

@seyedmostafahasani
Copy link
Collaborator Author

@seyedmostafahasani We cannot change api on V6.X, if we integrate such api change, we will need to bump to V7 and all apps using the package will have to upgrade their integration. as the team have a lot of api changes in mind, we try to keep api interoperability as much as possible.

Here is a sample: https://github.com/TheWidlarzGroup/react-native-video/pull/3867/files#diff-e2131d0631cdc1ddf0ba36827a27b86adf8e5b8ed162a280a53c6219f4df5a5f

I just move few props from the root of video to the source object, to avoid upgrade issue, I comment in doc that the old api is deprecated, and point to the new way to proceed.

It will allow easy upgrade for apps, we keep in mind that old api (deprecated) can be removed on V7. Can you please do the same thing please ? I think merging the 2 apis make sense, but we need to keep compatibility of old api some time

I completely agree with you about deprecating the old API and planning to remove it in V7. I will add deprecation notices for both presentFullscreenPlayer and dismissFullscreenPlayer. This approach ensures backward compatibility while allowing a smooth transition for users until V7, where we can fully remove the old API.

@seyedmostafahasani seyedmostafahasani changed the title chore: add setFullScreen to component's ref and remove presentFullscreenPlayer & dismissFullscreenPlayer chore: add setFullScreen to component's ref and deprecate presentFullscreenPlayer & dismissFullscreenPlayer Jun 1, 2024
@freeboub
Copy link
Collaborator

freeboub commented Jun 2, 2024

@seyedmostafahasani Thank you for the fix,
last remaining point, can you please remove deprecated functions in the sample please ? :)

following code shall be simplified:

  toggleDecoration() {
    this.setState({decoration: !this.state.decoration});
    if (this.state.decoration) {
      this.video?.dismissFullscreenPlayer();
    } else {
      this.video?.presentFullscreenPlayer();
    }
  }

@seyedmostafahasani
Copy link
Collaborator Author

@freeboub I removed the controls condition in the updateFullScreenButtonVisibility function. When the user sets controls={false}, the fullScreen button disappears in fullScreen mode, requiring the user to press the physical back button to exit fullScreen mode, which may cause confusion. What is your opinion?

@freeboub freeboub requested a review from YangJonghun June 6, 2024 21:00
@freeboub freeboub requested a review from KrzysztofMoch June 6, 2024 21:00
@YangJonghun
Copy link
Contributor

I don't use native controls and fullscreen in this library, but I'm not sure if this breaking change is really necessary in this library.
It's not a duplicate function, so it doesn't have much effect on user DX as long as user pass an argument. Also, It's easy to remove useState and keep the existing API, so why we make breaking change?

@freeboub
Copy link
Collaborator

freeboub commented Jun 9, 2024

It is not a breaking change as previous api are still working! It is just a preparation for api clean up ! (Let say for V7)

@YangJonghun
Copy link
Contributor

@freeboub
oh..then I misunderstood.
(If possible, it would be nice to have something like a new-arch only prop that works synchronously. ref.fullscreen = true)

@freeboub
Copy link
Collaborator

freeboub commented Jun 9, 2024

Yes I agree, Fullscreen management is one of the next challenge I think...

Copy link
Collaborator

@KrzysztofMoch KrzysztofMoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KrzysztofMoch KrzysztofMoch changed the title chore: add setFullScreen to component's ref and deprecate presentFullscreenPlayer & dismissFullscreenPlayer chore: add setFullScreen to component's ref Jun 10, 2024
@freeboub freeboub merged commit 3a4a130 into TheWidlarzGroup:master Jun 10, 2024
12 checks passed
@seyedmostafahasani seyedmostafahasani deleted the feat/fullScreen-functionality branch June 11, 2024 06:35
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.

4 participants