chudongvip / awesome_video_player

This is a flutter package of video player. it's a very simple and easy to use.
MIT License
196 stars 36 forks source link

Question #9

Closed SdxCoder closed 4 years ago

SdxCoder commented 4 years ago

I have a list of video urls as a listview and onTap i want to load the player with new url, i tried setstate, changeNotifier, but its not working, can you help please?

chudongvip commented 4 years ago

yes, i'd love to.

  // update video url with Future.delayed when you click the item from listview
  // ps: I haven't found a better way yet. I'll try to make it work better
  void updateVideoSource() {
    setState(() {
      videoUrl = "";
      Future.delayed(Duration(milliseconds: 100), () {
        setState(() {
          videoUrl = "https://www.runoob.com/try/demo_source/movie.mp4";
        });
      });
    });
  }

if you have any questions let me now. i will reply to you as soon as possible.