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(typescript): type checks on selectedTextTrack, selectedAudioTrack, selectedVideoTrack #3910

Conversation

Polarisation
Copy link
Contributor

@Polarisation Polarisation commented Jun 14, 2024

Summary

Fix type checks on selectedTextTrack, selectedAudioTrack and selectedVideoTrack properties which were added in #3704.

Motivation

selectedTextTrack, selectedAudioTrack and selectedVideoTrack can both be an object with a type property and an undefined value. This allows react-native-video to distinguish between disabled subtitles and subtitles following system settings.

However this behavior was broken by the addition of an incorrect type check in #3704 which does not allow the value property to be undefined.

Changes

Adapted the type check to allow value property to be undefined, as per documentation and TypeScript type definitions.

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.

thank you for the patch, I am just proposing you to improve the log. I let you integrate the change

@Polarisation Polarisation changed the title Fix type checks on selectedTextTrack and selectedAudioTrack Fix type checks on selectedTextTrack, selectedAudioTrack, selectedVideoTrack Jun 14, 2024
@Polarisation
Copy link
Contributor Author

@freeboub Thank you, I made those changes. I also applied the same fix to selectedVideoTrack as I noticed this had the same bug.

@freeboub
Copy link
Collaborator

@freeboub Thank you, I made those changes. I also applied the same fix to selectedVideoTrack as I noticed this had the same bug.

You are right, thank you !

@KrzysztofMoch KrzysztofMoch changed the title Fix type checks on selectedTextTrack, selectedAudioTrack, selectedVideoTrack fix(typescript): type checks on selectedTextTrack, selectedAudioTrack, selectedVideoTrack Jun 16, 2024
KrzysztofMoch and others added 3 commits June 19, 2024 11:49
Co-authored-by: Olivier Bouillet <[email protected]>
Co-authored-by: Olivier Bouillet <[email protected]>
Co-authored-by: Olivier Bouillet <[email protected]>
@KrzysztofMoch KrzysztofMoch merged commit dc2a2ab into TheWidlarzGroup:master Jun 19, 2024
2 checks passed
@Polarisation Polarisation deleted the fix-selected-track-type-check branch June 19, 2024 10:31
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.

3 participants