flutter_playout
flutter_playout copied to clipboard
No notification in iOS 13.3
When I play the video on iPhone 8 simulator with iOS 13.3 I get no notifications. Am I doing something wrong or it's a bug?
_videoPlayer = Video(
autoPlay: true,
url: link,
title: 'Title',
subtitle: 'Subtitle',
);
Try adding this to Video(),
onViewCreated: (viewId) {
listenForVideoPlayerEvents(viewId);
},
How can I add this while using just Video class without implementing PlayerObserver?
Please see lib/player_observer.dart
. It's just an EventChannel
based on the created viewId
.
EventChannel eventChannel = EventChannel(
"tv.mta/NativeVideoPlayerEventChannel_$viewId", JSONMethodCodec());
eventChannel.receiveBroadcastStream().listen(_processEvent);
Then see implementation of _processEvent(dynamic event)
for various events.
It would be great if EventChannel
was setup during widget creation inside the Video
class, so we can create Video
instance anywhere while having notifications out of the box.
Then we can have optional onPlayerEvents
param if we want to listen for the player events. Something like this:
_videoPlayer = Video(
autoPlay: true,
url: link,
title: 'Title',
subtitle: 'Subtitle',
onPlayerEvents: (event) {
if(event == Event.PAUSED) ...
} );
Sorry to bother you so much. If you agree with my ideas I could try creating PRs.
Right so with this there would be a few things to iron out. Firstly, I think this would make the client code more unreadable since onPlayerEvents
would be responsible for handling all events so you'll end up with a lot of if
statements. Secondly, a few events also return data for example onTime
returns the current play head position. So then this method would also need to provide a way for that; making code more unreadable. Lastly, I wanted to keep observer as a pluggable component because soon I want to implement client side player analytics integrating with Brightcove and Google Analytics. So then those analytics would extend PlayerObserver
and in client implementation instead of mixing PlayerObserver
, we'll mix something like PlayerObserverWithGoogleAnalytics
.
Okay. I just don't like we need to implement PlayerObserver
in order to get notifications, it should be not connected together. Moreover, I just tried to implement PlayerObserver
and got no notifications.
Also requirement to call listenForVideoPlayerEvents
makes the plugin API not so clean looking.
What if we make optional param playerObserver
like this:
_videoPlayer = Video(
autoPlay: true,
url: link,
title: 'Title',
subtitle: 'Subtitle',
playerObserver: PlayerObserverWithGoogleAnalytics(),
);
While calling listenForVideoPlayerEvents
automatically whenever or not playerObserver
specified?
I use example project run on iOS but not show notification, test on iOS 12 and iOS 13 help me pls
Same, just tried latest version and still no notifications.
I call listenForVideoPlayerEvents(viewId);
, where can be error?