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 loop (repeat) freeze on android

See original GitHub issue

Current behavior

I have short video (duration 15 sec.). Video plays with prop repeat true. After approx. 1 minute of being on screen, video freeze. This only happens on Android. Also after waiting for 10 minutes, the video starts to play again My videos are stored on google cloud platform https://storage.googleapis.com/video-footstats/versoix.MOV

Reproduction steps

My component is exactly like this

import React from "react";
import { AppRegistry, View, StyleSheet, Dimensions, TouchableOpacity } from "react-native";
import { StyleProvider, Root} from "native-base";
import Video from 'react-native-video';
import styles from '../Styles';

const { width, height } = Dimensions.get('window');

class SingleVideo extends React.Component {

    constructor(props){
        super(props);
        this.state = {
          screenWidth: width,
          heightScaled: 0,
          display:'none'
        };
    }

    onBuffer(){}

    onEnd(){}
    
    videoError(e){console.log(e)}

    render() {
      return (
        <View style={styles.flatListSocialFeed}>
          <Video source={{uri: 'https://storage.googleapis.com/video-footstats/versoix.MOV'}}
             ref={(ref) => {
               this.player = ref
             }}
             onBuffer={this.onBuffer.bind(this)}
             onEnd={this.onEnd.bind(this)}
             onError={this.videoError.bind(this)}
             paused={false}
             onLoad={response => {
              const { width, height } = response.naturalSize;
              var heightScaled = height * (this.state.screenWidth / width);
              if(heightScaled>350){
                heightScaled = 350
              }
              this.setState({heightScaled,display:'flex'});
             }}
             repeat={true}
             muted={true}
             resizeMode={"contain"}
             style={{
                width: this.state.screenWidth,
                height: this.state.heightScaled,
                display: this.state.loaded
          }} />
        </View>
      );
    }
}
export default SingleVideo;

Expected behavior

Video should not freeze.

Platform

  • Android ExoPlayer

Video sample

None

Issue Analytics

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

github_iconTop GitHub Comments

7reactions
kirillplatonovcommented, Sep 18, 2018

I have similar problem. I don’t use loop. But it freezes on second attempt to play video. The problem happens only on Android.

3reactions
JakubPodcommented, Jul 8, 2019

I know this is a 1-year-old issue, but since it’s still open and since I still run into it myself recently, I’m going to share my workaround.

Cache your video before playing it. I used react-native-video-cache to cache video and then react-native-fs to clear the cache. Now it loops flawlessly.

There might be a better way to do it without using two libs, but this was the most convenient for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MediaPlayer freezes instead of looping video on Android 4.4
I am playing a video in a loop. This worked very well for all users, until the Tab 3 got updated to Android...
Read more >
Video Freezes / Hangs/ Doesn't play smoothly WHEN LOOPING
When I loop a small section in my session, to accurately fill in footsteps (for example) the video freezes for about 1.5 seconds, ......
Read more >
Loop videos or playlists on YouTube - Android - Google Support
To repeat a video within the playlist, tap Loop again for a 1 to appear in the middle . This video will repeat...
Read more >
[Update: Nov. 30] YouTube bugs/issues & pending ...
It also releases updates regularly for the application on Android and ... IST 06:18 pm: The freezing issue when pausing a YouTube video...
Read more >
How to Edit Freeze Frame Video Effect in CapCut - IoForth
For Android users, CapCut is a handy video editor. When it comes to framing videos on CapCut, you may find it a bit...
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