davidohayon669 / react-native-youtube

A <YouTube/> component for React Native.
MIT License
1.16k stars 472 forks source link

After ended event not playing again on first time #395

Open imadarif opened 5 years ago

imadarif commented 5 years ago

after listen ended event, i reset the play prop to true then it show paused event in status then i press again true it show paused event then after this it start playing

davidohayon669 commented 5 years ago

@imadarif iOS / Android? can you reproduce this with the example app?

imadarif commented 5 years ago

RN 0.59.5 MAC OSX MOJAVE

BOTH PLATFORM,

REPRODUCE: i control playing of video by state.

just set the state to false play : false,

then user do it by self by press button of play to play video and pause to pause video. state change on each click. if video end then i try to again play video by changing state to true. youtube props of status return paused status 2 time then i change state again then it start playing.

MY CODE: import YouTube from "react-native-youtube"; <YouTube resumePlayAndroid={false} apiKey={API_KEY} showFullscreenButton={true} videoId={this.props.youtubeId} // The YouTube video ID play={this.state.play} // control playback of video with true/false modestbranding={true} controls={2} // fullscreen={this.state.fullscreen} rel={false} showinfo={false} onReady={e => this.setState({ isReady: true })} onChangeState={e => { if ( this.state.status === "ended" || this.state.status === "stopped" ) this.setState({ status: e.state, play: false }); else this.setState({ status: e.state }); }} onChangeQuality={e => this.setState({ quality: e.quality })} onError={e => this.setState({ error: e.error })} style={{ alignSelf: "stretch", height: 200 }} />