在reactjs中更新HTML5视频src
我有下一个部分:在reactjs中更新HTML5视频src,reactjs,Reactjs,我有下一个部分: class UserDetail extends Component { render() { if (!this.props.user) { return (<div></div>); } return ( <div> <div>{this.props.user.first} {thi
class UserDetail extends Component {
render() {
if (!this.props.user) {
return (<div></div>);
}
return (
<div>
<div>{this.props.user.first} {this.props.user.last}</div>
<div>Age: {this.props.user.age}</div>
<div>Description: {this.props.user.description}</div>
<video width="750" height="480" controls id='thevid'>
<source src={this.props.user.video} type="video/mp4"></source>
</video>
</div>
);
}
}
然后视频将更新到源链接
但实际上我不知道怎么做
请帮助更新
标签上的src
在设置后似乎没有任何作用
使用refs手动设置视频的src,或者通过将src传递给
组件来设置更好的方式
<video width="750" height="480" controls id='thevid' src={this.props.user.video} />
<video width="750" height="480" controls id='thevid' src={this.props.user.video} />