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.

Video pauses every seconds on Android

See original GitHub issue

Hi. It’s working on iOS, There is no problem. But on Android, It’s not working properly. Video is starting playing but pauses every second, So I have to press a resume button each time. On full screen, It’s working properly.

I found two following exceptions when the video got paused.

java.util.concurrent.ExecutionException: com.android.volley.ServerError
    at com.android.volley.toolbox.RequestFuture.a(:com.google.android.gms@11580470:4)
    at com.android.volley.toolbox.RequestFuture.get(:com.google.android.gms@11580470:2)
    at com.google.android.gms.herrevad.services.RemoteReportsRefreshChimeraService.a(:com.google.android.gms@11580470:25)
    at com.google.android.gms.herrevad.services.ImmediateRemoteReportsRefreshChimeraService.onHandleIntent(:com.google.android.gms@11580470:1)
    at btz.handleMessage(Unknown Source:6)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.os.HandlerThread.run(HandlerThread.java:65)
 Caused by: com.android.volley.ServerError
    at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms@11580470:37)
    at mhb.performRequest(:com.google.android.gms@11580470:4)
    at com.android.volley.NetworkDispatcher.run(:com.google.android.gms@11580470:12)
java.lang.IllegalStateException: Handler (ipn) {b23eed8} sending message to a Handler on a dead thread
    at android.os.MessageQueue.enqueueMessage(MessageQueue.java:545)
    at android.os.Handler.enqueueMessage(Handler.java:662)
    at android.os.Handler.sendMessageAtTime(Handler.java:631)
    at android.os.Handler.sendMessageDelayed(Handler.java:601)
    at android.os.Handler.sendEmptyMessageDelayed(Handler.java:565)
    at android.os.Handler.sendEmptyMessage(Handler.java:550)
    at ipn.run(SourceFile:10)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)

Has anyone encountered this problem?

React : 16.2.0 React Native : 0.52.0 React Native Youtube : 1.1.0

Issue Analytics

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

github_iconTop GitHub Comments

9reactions
motogodcommented, Mar 5, 2019

In my case, I can’t find out the overlay.

I just use work around on onChangeState when user click play button make it fullscreen.

  // for youtube control bar issue in android
  handleReady = () => {
    setTimeout(() => this.setState({ height: 281 }), 500);
  }

  changeFull = (event) => {
    console.log('event:', event);
    if (Platform.OS === 'android') {
      if (event.state === 'playing') {
        this.setState({ fullscreen: true });
      } else if (event.state === 'paused' || event.state === 'ended') {
        this.setState({ fullscreen: false });
      } else {
        console.log('nothing');
      }
    }
  }

            <YouTube
              videoId={videoId[0]}   // The YouTube video ID
              play={false}             
              fullscreen={this.state.fullscreen}
              apiKey={ApiAndId.youTuBeId}
              onError={e => {
                console.log(e);
              }}
              onReady={this.handleReady}
              onChangeState={event => this.changeFull(event)}
              style={{ alignSelf: 'stretch', height: this.state.height }}
            />

But it still has the problem that user click hardware back button when Youtube under fullscreen. Overlay will happen again.

4reactions
sfratinicommented, Apr 17, 2018

In my case is due to React Native Navigation package and I have no idea how to solve this:

04-17 15:30:42.344 16627 16627 W YouTubeAndroidPlayerAPI: YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is obscured by com.reactnativenavigation.views.SnackbarAndFabContainer{57317a5 V.E… … 0,0-1440,2358}. YouTubePlayerView is completely covered, with the distance in px between each edge of the obscuring view and the YouTubePlayerView being: left: 42, top: 713, right: 42, bottom: 449…

Read more comments on GitHub >

github_iconTop Results From Across the Web

SOLVED! - Video Stops Playing After a Few Seconds Android
Most Android phones will automatically pause videos when you unplug the headset and play the video when you plug the headset. If the...
Read more >
Android Phone Keeps Pausing Music & Video: Why? (& Fix)
Here's why your Android phone keeps pausing music and videos and how to fix it: Most of the time, video or music will...
Read more >
Every video keeps pausing after only playing for a little bit
Every video I watch will play for a few seconds (sometimes a minute if I'm lucky) and then it would just pause itself!...
Read more >
Videos keep on pausing every few seconds.. please get me ...
Try restarting the phone, so that all unneeded apps aren't running. Then, try playing a video. Start with ones that you have on...
Read more >
How To Fix YouTube Video Keeps Pausing On Android
YouTube keeps pausing on Android or sometimes it forced to stop too. You don't need to worry again because we will try to...
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