-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
[Question] How to play video with start time? #228
Comments
final Future<Duration> duration = player.streams.duration.first;
await player.open(Media(file.path), play: false);
await duration;
await player.seek(targetPosition);
await player.play(); |
cc @ethicnology. There is still not a dedicated solution; but above shall work. |
I adapted my UX to solve this need. |
This comment was marked as off-topic.
This comment was marked as off-topic.
I've tried this: await player.stream.buffer.first;
player.seek(targetPosition); instead of |
We can't just publish a feature if it works for some cases. We want it to work for every case & every backend (native & web) with appropriate unit-tests. You are free to use the solutions provided here (which hopefully work). But if the package releases something "stable" it becomes our responsibility to ensure its functioning. |
But I think there still should be a stable way to make sure the video is "load finished", means remote video source is available and we can freely do actions like seek. Maybe |
@Prince-of-death Welcome to open source and free softwares where the scarce free time of developers is gifted to us I recommend you start learning how to contribute to the codebase and implement this feature if it is so crucial for you, if not, you should work around the problem with one of the solutions offered above. |
This comment was marked as off-topic.
This comment was marked as off-topic.
I don't know if it worked before, but now (media_kit: ^1.1.10, media_kit_video: ^1.2.4, media_kit_libs_video: ^1.0.4) it doesn't work. For me, this solution worked await player.open(Media(file.path), play: false);
controller.player.stream.duration.listen((event) async {
if (event.inSeconds > 0){
await player.seek(const Duration(seconds: targetPosition));
await player.play();
}
}); |
I did implement this in the latest PR: Thanks! |
Is there any way to play video begin from a specific time like this command:
mpv --start=100 loadfile 'http://host/a.mp4' append
The text was updated successfully, but these errors were encountered: