Video searching for doesn’t work (video begins taking part in at 0 secs) on Flutter (iOS, Chrome, Safari, iPhone). The identical code works on Chrome on Mac, an iPad, however simply not on an iPhone. This app was deployed utilizing Firebase.
Ideally I might like my movies to solely begin taking part in from a sure time limit. I assumed searching for throughout initialisation could be the best way to do it, however it does not appear to work on Net on my iPhone, which is the first use-case I’ve.
That is my instance code.
import 'package deal:flutter/materials.dart';
import 'package deal:video_player/video_player.dart';
void fundamental() => runApp(const VideoApp());
/// Stateful widget to fetch after which show video content material.
class VideoApp extends StatefulWidget {
const VideoApp({tremendous.key});
@override
_VideoAppState createState() => _VideoAppState();
}
class _VideoAppState extends State {
late VideoPlayerController _controller;
@override
void initState() {
tremendous.initState();
_controller = VideoPlayerController.networkUrl(Uri.parse(
'https://flutter.github.io/assets-for-api-docs/belongings/movies/bee.mp4'))
..initialize().then((_) {
_controller.seekTo(Period(seconds: 3));
setState(() {});
});
}
@override
Widget construct(BuildContext context) {
return MaterialApp(
title: 'Video Demo',
residence: Scaffold(
physique: Middle(
youngster: _controller.worth.isInitialized
? AspectRatio(
aspectRatio: _controller.worth.aspectRatio,
youngster: VideoPlayer(_controller),
)
: Container(),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
// _controller.seekTo(Period(seconds: 3));
_controller.worth.isPlaying
? _controller.pause()
: _controller.play();
});
},
youngster: Icon(
_controller.worth.isPlaying ? Icons.pause : Icons.play_arrow,
),
),
),
);
}
@override
void dispose() {
_controller.dispose();
tremendous.dispose();
}
}