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

Video loop (repeat) freeze on android #1239

Closed
camel113 opened this issue Sep 16, 2018 · 5 comments
Closed

Video loop (repeat) freeze on android #1239

camel113 opened this issue Sep 16, 2018 · 5 comments
Labels
stale Closed due to inactivity or lack or resources

Comments

@camel113
Copy link

camel113 commented Sep 16, 2018

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

@kirillplatonov
Copy link

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

@JakubPod
Copy link

JakubPod commented 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.

@CHaNGeTe
Copy link
Contributor

CHaNGeTe commented Jul 8, 2019

Can you check on #1655 ?
PR was not designed for this, but it is solving some async issues when setting props.

@CHaNGeTe
Copy link
Contributor

CHaNGeTe commented Jul 8, 2019

It works for me on that branch

@pmella16
Copy link

pmella16 commented Jan 6, 2021

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

mee too, any solution? :(

@hueniverse hueniverse added the stale Closed due to inactivity or lack or resources label Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Closed due to inactivity or lack or resources
Projects
None yet
Development

No branches or pull requests

6 participants