Reputation: 1027
I have a .m3u8 video URL that works perfectly when played on a browser player and continously shows the live video.
However with video_player on Flutter, after initializing the video controller, only about 20 or so seconds is available in the player, and when reaching the end of it, it does not continue playing and stops playing the video as if it is a limited 20 second video.
If I want to see the next few seconds or closer to the live feed, I need to dispose and reinitalize the controller.
I don't see this issue posted anywhere so where am I going wrong?
videoPlayerController = VideoPlayerController.network('https://example.com/abcdef.m3u8');
(videoPlayerController.value.isInitialized)
?
Expanded(
child: VideoPlayer(
videoPlayerController,
),
)
: Text('Nope'),
SizedBox(
height: screenHeight * 0.1,
),
SizedBox(
width: screenHeight * 0.2,
child: FloatingActionButton(
heroTag: 'Start',
onPressed: () async {
await videoPlayerController.initialize();
videoPlayerController.play();
home.notifyListeners();
},
child: const Text('Start'),
),
),
Upvotes: 4
Views: 1338
Reputation: 1027
I found the reason why I have been experiencing this problem.
In my testing I have also setup RTMP streaming through the camera plugin, and I had that on while I tried to fetch the HLS video. I thought both are unrelated so it shouldn't affect anything but perhaps they both use a same library, so that's why the issue. With no streaming being done, the HLS video plays normally as expected.
Upvotes: 3