-
Notifications
You must be signed in to change notification settings - Fork 47
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_videohole] Add get duration API for live stream #643
Conversation
Live stream duration is a range.
packages/video_player_videohole/tizen/src/video_player_tizen_plugin.cc
Outdated
Show resolved
Hide resolved
@@ -271,7 +276,7 @@ class VideoEvent { | |||
/// Duration of the video. | |||
/// | |||
/// Only used if [eventType] is [VideoEventType.initialized]. | |||
final Duration? duration; | |||
final DurationRange? duration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/flutter/packages/blob/main/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart#L229
Can't we just keep Duration
type and use the value of duration.second
returned by mediaplayer?
The interface that returns DurationRange
for stream play seems to be buffered
. (https://github.com/flutter/packages/blob/main/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart#L244)
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For live stream, the duration is a range which includes start time and end time.
player_get_adaptive_streaming_info(player_, (void *)&live_duration_buff, PLAYER_ADAPTIVE_INFO_LIVE_DURATION);
When call seekTo, the time must be in the range, the start time is only used to judge. If remove start time, we might have seekTo issue.
I have tested seekTo for live stream, if we get live stream duration is [300, 500] and then call seekTo(200), the player just start with 300.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My worry is the change in interface. (I know, we have a separate interface from video_player_platform_interface.)
In my opinion..
When a user needs a seekTo point in valid range of streaming content, they can check the valid seekTo by taking the value from buffered
rather than the duration value.
https://github.com/flutter/packages/blob/36a7b99381f85e86914e82c75fc7d9038ed96cca/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart#L241-L244
/// Buffered parts of the video.
///
/// Only used if [eventType] is [VideoEventType.bufferingUpdate].
final List<DurationRange>? buffered;
Our int buffered
is progress value of buffering. so we can change this API.
Of course, we don't necessarily have to follow the video_player_platform_interface, so this can be reconsidered later.
Live stream duration is different from common video duration.