微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

video.play() 后我听到声音,但视频不起作用

如何解决video.play() 后我听到声音,但视频不起作用

  const toggleVideo = () => {
    const currentVideo = videoRef.current

    if (isPlaying) {
      currentVideo.pause()
      setIsPlaying(false)
    } else {
      currentVideo.play()
      setIsPlaying(true)
    }
  }
<div className="video-wrapper">
  <video ref={videoRef}>
    <source src={src} type='video/mp4' />
  </video>
  <div className={isPlaying ? '' : "video-playpause"} ref={videoButtonRef}></div>
</div>

我想使用自定义按钮 为什么视频不起作用? 声音工作正常。停止,开始,停止……一切正常,但视频无法播放。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。