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

feat: allow customization of tvOS playback expierence #3216

Conversation

Duell10111
Copy link
Contributor

This PR would allow to customize the tvOS playback expierence as descripted here:
https://developer.apple.com/documentation/avkit/customizing_the_tvos_playback_experience#3820220

The custom title, subtitle and description are all optional and can specified in the source object.
These props are not handled on android side.

Additionally this PR allows to adapt the chapters interface for tvOS, according to the documentation:
https://developer.apple.com/documentation/avkit/presenting_navigation_markers#2948687
For providing custom chapters, a new prop chapters got introduced.

Provide an example of how to test the change

The changes can be tested in the tvOS example project, by running on an tvOS simulator.

playerItem.externalMetadata = createMetadataItems(for: mapping)
}

#if os(tvOS)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this #if can be earlier in this function to avoid unnecessary computation on mobile ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The external metadata can also be set on iOS to replace the asset metadata, therefore I only restricted the navigationMarker Groups to tvOS as this is only working on tvOS.
https://developer.apple.com/documentation/avfoundation/avplayeritem/1627623-externalmetadata

}

#if os(tvOS)
private func makeNavigationMarkerGroups(_ chapters: [Chapter]) -> [AVNavigationMarkersGroup] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be good to extract these new functions in a new file...
This one is already too big.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I outsourced the functions to a new file

@freeboub
Copy link
Collaborator

freeboub commented Sep 9, 2023

@Duell10111 I forgot to publish my review :'(
I think this PR can be merged soon. please let me know

@Duell10111
Copy link
Contributor Author

@freeboub Thanks for the review, I outsourced the functions to Util files to reduce the code in the RCTVideo class.
I left the externalMetadata feature available on iOS as this could maybe also be helpful on iOS devices.

So from my POV the PR can be merged. :)

@freeboub freeboub merged commit a0fa831 into TheWidlarzGroup:master Sep 13, 2023
1 check passed
@Duell10111 Duell10111 deleted the tvos-custom-playback-exerpience-fork branch November 6, 2023 20:25
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