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

Video player controller cannot reference a List of Strings/array of paths to videos to loop and make a playlist #22015

Closed
Chimba123 opened this issue Sep 19, 2018 · 7 comments

Comments

@Chimba123
Copy link

The Video player plugin apparently cannot loop through a string of paths/array that reference multiple videos locally. The controller only accepts one string. What if one wants to display/play 50, 100 or even a 1000 videos? the controller is insufficient for this implementation lest I am missing something

@harisk92
Copy link

harisk92 commented Sep 19, 2018

@Chimba123 dispose current controller and create new one with uri of video you want to play.And if you want autoplay functionality you need to check if current video is finished.Set listener on controller which checks current position of video against duration.

@Chimba123
Copy link
Author

Chimba123 commented Sep 19, 2018 via email

@Chimba123
Copy link
Author

@harisk92 do you have a working example?

@harisk92
Copy link

harisk92 commented Sep 21, 2018

@Chimba123

void play(String url) {
     controller = VideoPlayerController.network(url);		    
     controller.initialize().then((_) => setState(() {}));		       
     controller.play();		       
     controller.addListener(checkIfVideoFinished);		       
   }		
		
   void checkIfVideoFinished() {		
     if (controller == null ||		
         controller.value == null ||		
         controller.value.position == null) return;		
     if (controller.value.position.inSeconds ==		
         controller.value.duration.inSeconds) {
         controller.removeListener(checkIfVideoFinished);
         controller.dispose();			
         play(nextVideoUrl);		
       }		
     }		
   }

Sorry for late response.

@Chimba123
Copy link
Author

Chimba123 commented Sep 21, 2018 via email

@zoechi
Copy link
Contributor

zoechi commented Sep 23, 2018

Looks like this is about a support question that got answered.

@zoechi zoechi closed this as completed Sep 23, 2018
@github-actions
Copy link

github-actions bot commented Sep 2, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants