question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onPlaybackRateChange is not fired

See original GitHub issue

Bug

onPlaybackRateChange callback is not fired on android when player is paused or played.

Platform

Which player are you experiencing the problem on:

  • Android ExoPlayer
  • Android MediaPlayer

Environment info

React native info output:

System:
    OS: macOS 11.0.1
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
    Memory: 21.38 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v14.16.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.3/12C33 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.12 => 16.12.0
    react-native: github:jitsi/react-native#891986ec5ecaef65d1c8a7fe472f86cf84fe7551 => 0.61.5-jitsi.2

Library version: 5.1.1

Expected behaviour

  1. onPlaybackRateChange callback must be fired when user plays or pause the video.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Aaron46commented, May 11, 2022

I’m not an Android dev so I can’t say this is super correct, but this is what I changed to get this to work. I used patch-package to install.

index 482ff93..6998417 100644
--- a/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
+++ b/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
@@ -1270,8 +1270,10 @@ class ReactExoplayerView extends FrameLayout implements
         if (player != null) {
             if (!paused) {
                 startPlayback();
+                eventEmitter.playbackRateChange(rate);
             } else {
                 pausePlayback();
+                eventEmitter.playbackRateChange(0);
             }
         }
     }
1reaction
Saikedocommented, Apr 30, 2022

Same issue on Android,

Also on iOS there are multiple similar calls coming in one after another, not sure if that is expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

onPlaybackRateChanged works in iOS but not android (react ...
I'm wondering if anybody has found a workaround or a solution for this. I see issues in the repo that don't show anything, ......
Read more >
YouTube Player API Reference for iframe Embeds
This function loads the specified video's thumbnail and prepares the player to play the video. The player does not request the FLV until...
Read more >
Readme - react-native-video - npm
onPlaybackRateChange. Callback function that is called when the rate of playback changes - either paused or starts/resumes. Property, Type ...
Read more >
How to Use the YouTube IFrame API in React - freeCodeCamp
I'm not going to explore what we are doing with the handleExerciseComplete function in the live code, so for now we'll just log...
Read more >
Learn About Panopto Embed API
onPlaybackRateChange. This event will be raised when the video's ... Note: If the user is already authenticated, this will not fire. onError.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found