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

[BUG]onPlayerError/onSetupPlayer error are not being called on native side or they do not expose any error codes via bridge #63

Closed
fdobre opened this issue Jul 23, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@fdobre
Copy link

fdobre commented Jul 23, 2024

Description

"@jwplayer/jwplayer-react-native": "^1.0.1",
"react-native": "0.72.14"

Android: onPlayerError/onSetupPlayer are not called when there is an error regarding the hlsUrl or the signature token.

iOS: - when there is a video play error (invalid hls url or expired token) onPlayerError is not called. Instead, the onSetupPlayerError is called and event?.nativeEvent does not contain enough data for error handling in react native:

// event?.nativeEvent:
{"error": "This video file cannot be played.", "target": 7355}

Object should contain the error code. In case token is expired a fetch from BE could be done to obtain a new valid hlsUrl

To Reproduce

  1. Use an invalid hlsUrl (one that gives a 404) or use an expired signature.
  2. Add onSetupPlayerError and onError functions:
       onSetupPlayerError={(event: NativeError) => {
              console.log('=====setup error====', event?.nativeEvent);
       }}
      onPlayerError={(event: NativeError) => {
              console.log('=====error====', event?.nativeEvent);
      }
  1. Observe there are no logs on Android and on iOS there is no information about the error code.

Expected behavior
In case of any player or setup error at least one of the error functions should be called and the error code should be exposed in the nativeEvent object.

Screenshots / Visual evidence

Player displays error codes but these are not included in the nativeEvent or the onError functions are not being called.
Screenshot 2024-07-23 at 14 44 19

@fdobre fdobre added the needs-grooming Has not been reviewed by codeowners for scope/validation label Jul 23, 2024
@AmitaiB AmitaiB added the bug Something isn't working label Jul 24, 2024
@Jmilham21 Jmilham21 removed the needs-grooming Has not been reviewed by codeowners for scope/validation label Sep 4, 2024
@Jmilham21 Jmilham21 self-assigned this Oct 16, 2024
@Jmilham21
Copy link
Collaborator

This should be resolved in the main branch now as of merging #96. This will be packed into the next release to NPM.

@fdobre
Copy link
Author

fdobre commented Nov 28, 2024

@Jmilham21 First I would like to thank you for looking into this issue.

I've tested the new code.
I've tried to use latest master code ("@jwplayer/jwplayer-react-native": "github:jwplayer/jwplayer-react-native#671724dfadaf3ab74394e5a7cfbf325c8fb97c3a") or 83c1fd274caf26108eca5c43cd7e2318de91e456
but get

/node_modules/@jwplayer/jwplayer-react-native/ios/RNJWPlayer/RNJWPlayerView.swift:19:7 Type 'RNJWPlayerView' does not conform to protocol 'JWPlayerStateDelegate
`
Can you replicate?
Using latest code from 1.0.2 works ok.

Info:

System:
    OS: macOS 15.1.1
    CPU: (16) arm64 Apple M4 Max
    Memory: 232.86 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.18.0/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
    Watchman: 2024.11.11.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.16.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 24.0, iOS 18.0, macOS 15.0, tvOS 18.0, visionOS 2.0, watchOS 11.0
    Android SDK:
      API Levels: 28, 29, 30, 31, 32, 33, 34
      Build Tools: 27.0.3, 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.0, 30.0.2, 30.0.3, 31.0.0, 31.0.0, 32.0.0, 32.1.0, 33.0.0, 33.0.0, 33.0.0, 33.0.0, 33.0.1, 33.0.2, 34.0.0
      System Images: android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google X86_ARM Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86_64 Atom, android-30 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom_64, android-31 | Intel x86_64 Atom, android-31 | Google APIs ARM 64 v8a, android-31 | Google APIs Intel x86_64 Atom, android-31 | Google Play Intel x86 Atom_64, android-32 | Google APIs Intel x86_64 Atom, android-32 | Google Play Intel x86_64 Atom, android-33 | Google APIs Intel x86_64 Atom, android-33 | Google Play Intel x86_64 Atom, android-34 | Google APIs Intel x86_64 Atom, android-34 | Google Play Intel x86_64 Atom, android-35 | Google Play ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2024.2 AI-242.23339.11.2421.12550806
    Xcode: 16.0/16A242d - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.13 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: ^0.72.14 => 0.72.14 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

@Jmilham21
Copy link
Collaborator

This will be resolved in this PR @fdobre. I was heavy-handed with removing the soon-to-be-dropped callback in the ViewController class and took it out of the View class (which is still required by the delegate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants