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

如何重置当前视频进度? #302

Open
Ys-OoO opened this issue Oct 30, 2023 · 1 comment
Open

如何重置当前视频进度? #302

Ys-OoO opened this issue Oct 30, 2023 · 1 comment

Comments

@Ys-OoO
Copy link

Ys-OoO commented Oct 30, 2023

我在外层通过改变传递的url props 让Player播放不同的视频,但是怎么才能当url切换时重置或者将currentTime设置为0呢?
我尝试了

useEffect(()=>{
    messageContextRef.dispatchAction(ACTIONS.TIME_UPDATE,{currentTime:0})
},[url]) 

并不生效

组件如下:

export default function IVideo({ url, ...props }) {
  return (
    <div className={style.videoPlayer} {...props}>
      <Player
        shouldObserveResize={true}
        initialObjectFit={'contain'}
        className={style.player}
        locale="zh-Hans"
        autoplay={true}
        disablePictureInPicture={true}
        hiddenQualityMenu={true}
        sources={{
          hd: {
            play_url: url,
          },
        }}
      />
    </div>
  );
}
@ambar
Copy link
Collaborator

ambar commented Nov 6, 2023

按项目示例下的使用是有效的,如果可以的话,请提供一个示例。

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

No branches or pull requests

2 participants