shahen94 / react-native-video-processing

Native Video editing/trimming/compressing :movie_camera: library for React-Native
https://shahen94.github.io/react-native-video-processing/
MIT License
1.25k stars 326 forks source link

No sounds in my Videoplayer... #112

Closed selimonline closed 7 years ago

selimonline commented 7 years ago

constructor(props) { super(props); this.state = { video_src:this.props.video_src, //video_src:'file:///var/mobile/Containers/Data/Application/208D2C67-840C-41E5-A2AE-B702B8C20213/tmp/trim.2E928204-EDE2-4F6B-8849-3C7DB2005BAC.MOV', currentTime:0, startTime:0, endTime:-1, limitSecond:7, rotate:false, getSelection:0, playerStyle : styles.videoPlayer_main, trimStyle:'', trimSrc:'', clipsSrc:[] }; }

<VideoPlayer ref={ref => this.videoPlayerRef = ref} startTime={this.state.startTime} endTime={this.state.endTime} play={true} replay={true} playerWidth={screen.width} rotate={this.state.rotate} source={this.state.video_src} style={this.state.playerStyle} resizeMode={VideoPlayer.Constants.resizeMode.CONTAIN} onChange={({ nativeEvent }) => this.setState({currentTime:nativeEvent.currentTime}) } // get Current time on every second onEnd={({ eventDs }) => console.log(eventDs) } // get Current time on every second />

shahen94 commented 7 years ago

Please add this prop to your VideoPlayer component

volume={1}

If you could update README.md and open PR it would be great!

selimonline commented 7 years ago

Hi @shahen94 , thanks man.. It worked like a magic. I will add PR soon. btw, I am just looking for some other features. not sure... if those are available...

  1. rotate issue.. if user select landscape type video. it works fine. although extra white space at top. but if user select portrait type video.. it looks so weird. white space at left. https://image.prntscr.com/image/E_yCz22MRXe9Hfue8pOwtQ.png

  2. is any play function available?... like user click on a component.. and onPress will have player.start()... something like that

  3. replay={true} , not working always. specially if user don't select trim. video ends and don't replay.

Thanks buddy... I really appropriate your valuable time...

shahen94 commented 7 years ago
  1. Sorry man but i don't know how to fix it, we never faced with this issue before, maybe you can put some styles to fix it ?

  2. Just wrap VideoPlayer component with Touchable - like this

    <TouchableOpacity onPress={() => this.setState({ play: !this.state.play })}>
    <VideoPlayer play={this.state.play} />
    </TouchableOpacity>
  3. I heard about this issue before and now i believe that it exists. I don't have so much time to work on this issue in these days - Mainly i'll wait help from the community

selimonline commented 7 years ago

thanks again.. I fixed all as per my requirements...

  1. for portrait type video, we need to use rotate:true but need to detect a video is portrait or landscape type by videoinfo function

  2. that worked...

  3. if anybody face same issue, when video gets end, just set a function to replay video by setting play :true now, how to track video end, when currentTime and endTime gets same..

Thanks again @shahen94 You can close this issue...

chai86 commented 4 years ago

Hi @selimonline, how did you detect whether the video was portrait or not? I'm confused on this part. Thanks!