jwplayer / jwplayer-react-native

MIT License
32 stars 9 forks source link

[BUG] Typings need updating #56

Open jmurth1234 opened 4 months ago

jmurth1234 commented 4 months ago

Describe the bug The loadPlaylist method in the JWPlayer React Native SDK is using an incorrect type for its parameter. Currently, it uses PlaylistItem[], but it should be using JwPlaylistItem[]

Steps to reproduce the behavior:

  1. Open the TypeScript definitions for the JWPlayer React Native SDK
  2. Locate the loadPlaylist method definition
  3. Observe that the parameter type is PlaylistItem[] instead of JwPlaylistItem[]

Expected behavior The loadPlaylist method should accept a parameter of type JwPlaylistItem[] when forceLegacyConfig is false or not set. When forceLegacyConfig is true, it should accept PlaylistItem[].

Screenshots / Visual evidence N/A (This is a TypeScript definition issue, no visual evidence required)

Desktop (please complete the following information): N/A (This is a TypeScript definition issue, not a build issue)

Device(s) affected All devices using the TypeScript definitions for the JWPlayer React Native SDK

Additional context The current type definitions show:

loadPlaylist(playlistItems: PlaylistItem[]): void;

It should be:

loadPlaylist(playlistItems: JwPlaylistItem[]): void;
Jmilham21 commented 1 month ago

Hi @jmurth1234 , I have some work started on this here: https://github.com/jwplayer/jwplayer-react-native/tree/improvement/typing-and-updates-for-load-playlist

I ran into an issue where the iOS json parser didn't expose a method for the equivalent of a JwPlaylistItem, and rather than write a parser from scratch, I've made an internal ticket to expose the method. This will be addressed soon, but in the meantime I've updated the typing in the linked branch, allowed for sending a playlist URL in the loadPlaylist, and added the expected support for Android. So iOS should work right now, but passing in a JwPlaylistItem[] may not load all the fields.