ardera / flutter_packages

My collected packages for pub.dev
MIT License
28 stars 7 forks source link

gstreamer_video_player - issue on looping #25

Open kekko7072 opened 9 months ago

kekko7072 commented 9 months ago

@ardera I'm facing this issue on looping the video.

plugins/gstreamer_video_player/player.c: last gstreamer state change failed. gst_element_get_state(element name: pipeline0): GST_STATE_CHANGE_FAILURE
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(nativeerror, Input/output error, 5, null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
<asynchronous suspension>
#2      FlutterpiVideoPlayer.getPosition (package:flutterpi_gstreamer_video_player/src/platform.dart:155:20)
<asynchronous suspension>
#3      VideoPlayerController._applyPlayPause.<anonymous closure> (package:video_player/video_player.dart:582:41)
<asynchronous suspension>

Any possible solution to loop the video, the code used is from the example of the package.

kekko7072 commented 9 months ago

Fixed rebuilding the app, strange.

kekko7072 commented 9 months ago

I've tested for looping 10 minutes and some times still happen, how can i manage this exception? The unwanted output is that the app stop the videi and the only way is to kill and relaunch the app.

Kazumna commented 7 months ago

Have you found any solution? I've got the same error.

doug-ecofixa commented 7 months ago

Same problem here. I'm using a pi zero2, the video loops ok then stops.

Dec 05 08:20:52 fireplace flutter-pi[1278]: plugins/gstreamer_video_player/player.c: last gstreamer state change failed. gst_element_get_state(element name: pipeline0): GST_STATE_CHANGE_FAILURE Dec 05 08:20:52 fireplace flutter-pi[1278]: [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(nativeerror, Input/output error, 5, null) Dec 05 08:20:52 fireplace flutter-pi[1278]: #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651) Dec 05 08:20:52 fireplace flutter-pi[1278]: #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:322) Dec 05 08:20:52 fireplace flutter-pi[1278]: <asynchronous suspension> Dec 05 08:20:52 fireplace flutter-pi[1278]: #2 FlutterpiVideoPlayer.getPosition (package:flutterpi_gstreamer_video_player/src/platform.dart:155) Dec 05 08:20:52 fireplace flutter-pi[1278]: <asynchronous suspension> Dec 05 08:20:52 fireplace flutter-pi[1278]: #3 VideoPlayerController._applyPlayPause.<anonymous closure> (package:video_player/video_player.dart:582) Dec 05 08:20:52 fireplace flutter-pi[1278]: <asynchronous suspension>

fabioselau077 commented 6 months ago

Does the player allow an array of looping videos?

ardera commented 5 months ago

Okay, I've reproduced it, it seems to be either kernel or gstreamer related. Somehow, sometimes on end of stream, the buffer sharing between kernel and gstreamer gets confused - gstreamer thinks some buffer is currently not queued/used in kernel, but some time later it dequeues that exact buffer from the kernel and emits a stream error because that shouldn't have been possible. Though no idea what causes it.

As a super hacky workaround, one could create a new video player controller in flutter at every end of stream.