@Taro-小助手-honly 在 调用videoContext.play()不会播放 中说:
constructor() {
super(...arguments)
this.state = {
poster: true,
videoContext: null
}componentDidMount () {
const videoContext = Taro.createVideoContext('myVideo')
this.setState({
videoContext: videoContext
})
}
play = () => {
console.log('done')
this.state.videoContext.play()
this.setState({
poster: false
})
}
<Video
id='myVideo'
className='img2'
src='http://huya-w10.huya.com/1919/154920589/1300/cd2a187b606e13f722cf5e4638614313.mp4'
initialTime='0'
>
{
this.state.poster &&
<CoverView class='controls'>
<CoverView
class='play'
onClick={this.play}
style="width: 100%; height: 100%; background: rbga(0,0,0,0.5);"
>
</CoverView>
</CoverView>
}
</Video>
是在小程序里面 还是在h5