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

Not reloading when changing url with state #224

Closed
mahdidavoodi7 opened this issue Feb 10, 2019 · 7 comments
Closed

Not reloading when changing url with state #224

mahdidavoodi7 opened this issue Feb 10, 2019 · 7 comments
Labels

Comments

@mahdidavoodi7
Copy link

Hi,
Im giving url to the Player from state but i want when i change the state , the Player do not reload itself and just play the video from the new url.

  • I did this for securing my video
  • The url changes every 30 seconds
  • the video is same just url has changed

Here is my code :

class Lesson extends React.Component {
  state = {
    time: 0,
  }
  generateSecret = (time) => {
    //some code for generating secret 
  }
  componentDidMount() {
    this.interval = setInterval(() => {
      this.setState({time: new Date().getTime()});
    }, 10000);
  }
  render(){
    return( 
      <Player src={'http://localhost:8585/video/' + this.generateSecret(this.state.time)}>
        <BigPlayButton position="center" />
      </Player>
    )
  }
}

Any help regarding this would be helpful

@xiaoyuhen
Copy link
Member

xiaoyuhen commented Feb 11, 2019

Changing src will definitely reload, can't give you any help, because it is impossible to achieve.

But if your video is an fmp4 format, you can try MSE for byte-range loading.

@mahdidavoodi7
Copy link
Author

mahdidavoodi7 commented Feb 11, 2019 via email

@mahdidavoodi7
Copy link
Author

@xiaoyuhen
Does video-react support FMP4 format ? and have MSE ??

@xiaoyuhen
Copy link
Member

@mahdidavoodi7

video-react support FMP4 format, but video-react don't use MSE. very sorry about that.

@mahdidavoodi7
Copy link
Author

@xiaoyuhen

How about HLS ? Does video-react support it ??

@xiaoyuhen
Copy link
Member

video-react use hlsjs, so yeah, video-react support it

@mondaychen
Copy link
Member

Any further comments/concerns? If not I'm closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants