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

fix(android): fixed bug where video would not be visible after remount and change of drm source #3668

Merged

Conversation

YangJonghun
Copy link
Contributor

@YangJonghun YangJonghun commented Apr 9, 2024

Summary

fixed bug where video would not be visible after remount and change of drm source

Motivation

onAttachedToWindow called when component remount.
and initialization of player with drm prop have networking delay.
these situations cause the initializePlayer function to be called again while it is running.
overridden onAttachedToWindow code was written with PR #426.
in that time this code needed, but current code doesn't need this behavior. (it can be replaced by an action called inside setSrc)

Changes

  • do not initialize player when view attached to window
  • remove overridden Android native lifecycles (onDetachedFromWindow, onAttachedToWindow)

Test plan

  • prepare real device and two dash source with valid drm config.
  • change source and drm prop with user action(changeSource function changes source)
<Button title={'change source'} onPress={changeSource} />
<Video
    // for enforce remount without complicated component hierarchy
    key={source.uri}
    source={source}
    drm={drm}
 />

@YangJonghun YangJonghun changed the title fix(android): fixed a bug where video isn't visible when remount and drm source changed fix(android): fixed bug where video would not be visible after remount and change of drm source Apr 9, 2024
@KrzysztofMoch KrzysztofMoch requested a review from freeboub April 10, 2024 06:10
@freeboub
Copy link
Collaborator

This change shall replace following PR: https://github.com/react-native-video/react-native-video/pull/3300/files
For me the change make sens and is OK.
It would be interesting to have more tester for this PR ...

@KrzysztofMoch KrzysztofMoch merged commit 1af12f9 into TheWidlarzGroup:master Apr 16, 2024
3 checks passed
@YangJonghun YangJonghun deleted the fix/fix-android-lifecycle branch April 16, 2024 13:36
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