addCustomListeners method
void
addCustomListeners()
Implementation
void addCustomListeners() {
// Listener for video status
_listener1 = () {
if (value.isInitialized && !eventsSent.viewStartSent) {
eventsManager.sendViewStartEvent(uri.toString());
eventsSent.viewStartSent = true;
}
if (value.isPlaying && !eventsSent.playedSent) {
eventsManager.sendPlayEvent();
eventsSent.pausedSent = false;
eventsSent.playedSent = true;
}
if (!value.isPlaying && eventsSent.playedSent) {
eventsManager.sendPauseEvent();
eventsSent.pausedSent = true;
eventsSent.playedSent = false;
}
};
_listener2 = () {
if (!eventsSent.loadMetadataSent) {
eventsManager.sendLoadMetadataEvent(value.duration.inMilliseconds);
eventsSent.loadMetadataSent = true;
}
};
addListener(_listener1!);
addListener(_listener2!);
}