I am trying to play a local video file on flutter web but am getting stuck after choosing the video. According to this github post, it is possible to play a local video file by converting the uint8list of the video to a blob and then using videoController.network to play the blob: github. The problem is that I am not sure how to convert to a blob properly. How do I convert a uint8list to a blob and then play that blob in the flutter video player?
Asked
Active
Viewed 3,337 times
1 Answers
9
Url.createObjectUrlFromBlob(blob) from dart:html library does the trick:
import 'dart:html' as html;
// ...
final blob = html.Blob([bytes]);
final url = html.Url.createObjectUrlFromBlob(blob);
_controller = VideoPlayerController.network(url);

Spatz
- 18,640
- 7
- 62
- 66
-
It's can't play on Safari (MacOS)! – mducc Jul 09 '21 at 18:33
-
1Did you find a solution for playing on Safari MacOS? – Ali Akkawi Aug 29 '21 at 18:46
-
Can anyone confirm this issue on safari and is it related to the source of the video file? Might just be an issue with the encoding or something else.. – EzPizza Jan 06 '22 at 10:07