From a78fa1957fb22ddbf1a60224ba724486fd867572 Mon Sep 17 00:00:00 2001 From: li3317 Date: Thu, 22 Jul 2021 11:46:00 +0800 Subject: [PATCH] can play local video --- lib/src/widgets/video_app.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/widgets/video_app.dart b/lib/src/widgets/video_app.dart index b6f85cb8..44753a72 100644 --- a/lib/src/widgets/video_app.dart +++ b/lib/src/widgets/video_app.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -28,7 +30,7 @@ class _VideoAppState extends State { _controller = widget.videoUrl.startsWith('http') ? VideoPlayerController.network(widget.videoUrl) - : VideoPlayerController.asset(widget.videoUrl) + : VideoPlayerController.file(File(widget.videoUrl)) ..initialize().then((_) { // Ensure the first frame is shown after the video is initialized, // even before the play button has been pressed.