-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[video-player] When using HLS stream, duplicate events are fired by listener #108809
Labels
found in release: 3.0
Found to occur in 3.0
found in release: 3.1
Found to occur in 3.1
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
p: video_player
The Video Player plugin
P2
Important issues not at the top of the work list
package
flutter/packages repository. See also p: labels.
team-ecosystem
Owned by Ecosystem team
triaged-ecosystem
Triaged by Ecosystem team
Comments
@nateclicks I reported a similar thing here #107779 a while back. |
It is similar. I wasn't having issues with .mp4 files though. Mine was limited to HLS (m3u8) streams. But I only tested an MP4 on iOS. It looks like you weren't having the issue there either. |
Reproducible on Observations
Labeling for further insights. code sampleimport 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const VideoPlayerWidget(),
);
}
}
class VideoPlayerWidget extends StatefulWidget {
const VideoPlayerWidget({super.key});
@override
State<VideoPlayerWidget> createState() => _VideoPlayerWidgetState();
}
class _VideoPlayerWidgetState extends State<VideoPlayerWidget> {
late VideoPlayerController _controller;
// final url = "https://amssamples.streaming.mediaservices.windows.net/634cd01c-6822-4630-8444-8dd6279f94c6/CaminandesLlamaDrama4K.ism/manifest(format=m3u8-aapl)";
// final url = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8";
// final url = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8";
final url = "https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4";
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(
url,
formatHint: VideoFormat.hls,
videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true),
);
_controller.addListener(() {
if (_controller.value.isInitialized && _controller.value.position == _controller.value.duration) {
print('Video Ended');
}
});
_controller.initialize().then((value) {
_controller.play();
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(padding: const EdgeInsets.only(top: 20.0)),
const Text('With remote mp4'),
Container(
padding: const EdgeInsets.all(20),
child: AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
),
),
),
],
),
),
);
}
@override
void dispose() {
super.dispose();
}
}
flutter doctor -v
|
danagbemava-nc
added
plugin
p: video_player
The Video Player plugin
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
found in release: 3.0
Found to occur in 3.0
found in release: 3.1
Found to occur in 3.1
and removed
in triage
Presently being triaged by the triage team
labels
Aug 3, 2022
flutter-triage-bot
bot
added
the
package
flutter/packages repository. See also p: labels.
label
Jul 5, 2023
flutter-triage-bot
bot
added
team-ecosystem
Owned by Ecosystem team
triaged-ecosystem
Triaged by Ecosystem team
labels
Jul 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
found in release: 3.0
Found to occur in 3.0
found in release: 3.1
Found to occur in 3.1
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
p: video_player
The Video Player plugin
P2
Important issues not at the top of the work list
package
flutter/packages repository. See also p: labels.
team-ecosystem
Owned by Ecosystem team
triaged-ecosystem
Triaged by Ecosystem team
When using an HLS stream as the network source, a listener added to the video controller gets fired multiple times for the, seemingly, same event. In my case, I am using an event at the end of the video to trigger the start of the next video in a list. However, since the event at the end of the video is triggered more than once, the "next" video would get triggered more than once.
This does not happen if using an MP4 file (like what is in the example project from the widget).
Steps to Reproduce
initState()
of_BumbleBeeRemoteVideoState
with the code sampleflutter run
Expected results:
1 log entry of "Video Ended"
This is what happens if using a network .mp4
Actual results:
Multiple log entries of "Video Ended"
iOS - it is logged 9 times
Android - it is logged 2 times
The number of times also varies based on the HLS stream provided.
For example, in iOS:
Code sample
iOS Logs
Finally, paste the output of running
flutter doctor -v
here.The text was updated successfully, but these errors were encountered: