簡體   English   中英

Flutter 視頻播放進度

[英]Flutter video_player progress

我有一個 flutter 應用程序,其中安裝了video_playerchewie包。 我可以毫無問題地播放任何視頻,但我需要跟蹤視頻進度。 我嘗試使用偵聽器,但它無法按我想要的方式工作。

    _chewieController.addListener(() {
      int seconds = _chewieController.videoPlayerController.value.position.inSeconds;
      if (seconds == 60){ // just an example
        // do some action
      }
    });

視頻進度永遠不會調用偵聽器。 我應該怎么做才能讓它發揮作用?

我不知道chewie(看起來很酷)。 我認為您應該將偵聽器添加到 VideoController 實例(而不是咀嚼控制器)。

VideoPlayer package 給我們VideoProgressIndicator(controller, allowScrubbing: true)小部件,這樣你就可以將你的 VideoPlayer 包裝在 Stack 中,並將 VideoProgressIndicator 作為他們的孩子

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM