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): fix null pointer exception at playback start with item metadata #3879

Conversation

freeboub
Copy link
Collaborator

@freeboub freeboub commented Jun 6, 2024

Summary

Ensure we don't cause nullPointer exception (internally to exoplayer) when starting playback with notification enabled

Motivation

Avoid popup error

Changes

Extracting notification patch from this pull request:
https://github.com/TheWidlarzGroup/react-native-video/pull/3846/files#diff-a35ae7e6ae6efee3b22522a836bcbcdd9d59a214f087df454e4ccbb8cd5c0e76
Changes consist in initializing only once the mediaMetadata during source initialization

Test plan

Can be tested in sample, current issue can be reproduced by going on "no view" with next channel and going back to live channel with channel down

@freeboub
Copy link
Collaborator Author

freeboub commented Jun 6, 2024

@KrzysztofMoch please let me know if it makes sens for you please ?

Copy link
Member

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

Looks good for me
Only thing is that we are missing hashCode method in Source class (android studio is giving me warning also) I think we can use what android studio is proposing

override fun hashCode(): Int {
    var result = uriString?.hashCode() ?: 0
     result = 31 * result + (uri?.hashCode() ?: 0)
     result = 31 * result + startPositionMs
     result = 31 * result + cropStartMs
     result = 31 * result + cropEndMs
     result = 31 * result + (extension?.hashCode() ?: 0)
     result = 31 * result + (metadata?.hashCode() ?: 0)
     result = 31 * result + headers.hashCode()
     return result
}

WDYT ?

…ideo into fix/NullPointerExceptionInPlaybackStart

# Conflicts:
#	android/src/main/java/com/brentvatne/common/api/Source.kt
@freeboub freeboub merged commit c2cd752 into TheWidlarzGroup:master Jun 7, 2024
3 checks passed
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.

2 participants