ShariqMush / react-native-fullscreenvideo-player

A video player for React Native with controls
14 stars 34 forks source link

Full screen playing from current duration #9

Closed dip77 closed 6 years ago

dip77 commented 6 years ago

one need to update index.js file in video player

onToggleFullScreen() { if(Platform.OS === "android") { var uri = this.props.video.uri; *NativeModules.BridgeModule.showFullscreen(uri,this.state.currentTime1000);//passing MS as duration** //currentTime is stored in state and changes whenever onProgress gets called } else { this.player.presentFullscreenPlayer(); }

onProgress(event){ this.setState({ currentTime:event.duration }) }

ShariqMush commented 6 years ago

@dip77 Thanks for the pull request. What does this code do?

dip77 commented 6 years ago

so in full screen mode video plays from beginning instead of current duration. this bug is solved in this PR

Gabsys commented 6 years ago

Note to newbies: 1) onProgress(event) is an existing function in your index.js, not a new function. 2) It should be this.setState({currentTime:event.duration }) , not this.setState({currentTime:event.duration )} 3) public static int duration; should be written inside public class BridgeModule extends ReactContextBaseJavaModule{

Anyway, this update is not working for me. Got error : expected dynamic type 'double' but had type 'null' (constructing arguments for BridgeModule.showFullScreen at argument index 1)

Update: I fixed the problem and working perfectly by setting currentTime:event.duration to currentTime:event.currentTime

dip77 commented 6 years ago

@Gabsys issue 2nd and 3rd are now fixed. do event has currentTime property?

Gabsys commented 6 years ago

@dip77 Yes ~