I found this article to upload videos but it already has the urls of the videos written. I need to pass the videos through an api. Any ideas?? https://medium.com/@sanjeevmadhav03/preloading-videos-in-flutter-4b65cf0681c6
Asked
Active
Viewed 635 times
1
-
Usually it depends on the API to know if the video is playable in your system... Does your API give back a URL link to some MP4 video (starting with `https` and ending `.mp4`)? – VC.One Mar 01 '22 at 12:01
-
yes, the problem is that in the example of the link that passes, this static, but I need to know from the example how to add it by API In state.dart – pedroPablo garcia Mar 01 '22 at 16:18
-
I'm not understanding properly... You know how to get the URL (as String) but problem is giving to the video player function? If yes... Make the `urls` array as variable not const, then you can change the URLs inside. Maybe test by making your `urls[0] = your_URL_string_here;` then to play it you call `_playControllerAtIndex( 0 );` but you might need to do a `await _initializeControllerAtIndex(0);` before doing the play... – VC.One Mar 01 '22 at 17:01
-
but in the code it does not let me replace it with an await or a method and change the String of the URLs: – pedroPablo garcia Mar 01 '22 at 22:32
-
urls: const [ 'https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4#1', 'https://assets.mixkit.co/videos/preview/mixkit-young-mother-with-her-little-daughter-decorating-a-christmas-tree-39745-large.mp4', 'https://assets.mixkit.co/videos/preview/mixkit-mother-with-her-little-daughter-eating-a-marshmallow-in-nature-39764-large.mp4', 'https://assets.mixkit.co/videos/preview/mixkit-girl-in-neon-sign-1232-large.mp4', ], – pedroPablo garcia Mar 01 '22 at 22:35
-
ERROR: error: Factory bodies can't use 'async', 'async*', or 'sync*'. (non_sync_factory at [] lib\bloc\preload_state.dart:9) – pedroPablo garcia Mar 01 '22 at 22:38
1 Answers
0
Check if your api endpoint Supports upload of binary files. If it does, check if you're given url of the location of the video

Genial Ngash
- 41
- 2