For some reason the video player package or any other available video player packages is not deducting the duration of the video with the network link. I have tried other link with my code and it works perfectly. I have a link which I get from 'Whereby - a video call platform' which has all the necessary metadata and other stuffs but this link doesn't deduct the duration
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
class Example extends StatefulWidget {
const Example({super.key});
@override
State<Example> createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
late VideoPlayerController _controller;
late Future<void> _initializeVideoPlayerFuture;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.networkUrl(Uri.parse('url'));
_initializeVideoPlayerFuture = _controller.initialize();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
actions: [
IconButton(onPressed: (){
_controller.seekTo(const Duration(seconds: 10));
}, icon: const Icon(Icons.forward))
],
),
body: FutureBuilder(
future: _initializeVideoPlayerFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
);
} else {
return const Center(child: CircularProgressIndicator());
}
},
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
if (_controller.value.isPlaying) {
_controller.pause();
} else {
_controller.play();
}
});
},
child: Icon(
_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
),
),
);
}
}
I have tried with different packages, devices but it is not working. Since I don't get the duration I am not able to control the player like changing the video forward or backward or to specific duration.