/**
  * @param PostBroadcastEvent $event
  */
 public function onPostBroadcast(PostBroadcastEvent $event)
 {
     /** @var LiveBroadcast $liveBroadcast */
     $liveBroadcast = $event->getLiveBroadcast();
     $output = $event->getOutput();
     if ($output instanceof OutputYouTube) {
         $redirectUri = $this->redirectService->getOAuthRedirectUrl();
         $this->youTubeApiService->initApiClients($redirectUri);
         $channel = $output->getChannel();
         $this->youTubeApiService->transitionState($liveBroadcast, $channel, YouTubeEvent::STATE_REMOTE_LIVE);
     }
 }
 /**
  * @param SwitchMonitorEvent $event
  */
 public function onSwitchMonitor(SwitchMonitorEvent $event)
 {
     $this->monitorBroadcast = $event->getMonitorBroadcast();
     $this->plannedBroadcast = $event->getPlannedBroadcast();
     $this->channel = $event->getChannel();
     if (!$this->channel instanceof ChannelYouTube) {
         return;
     }
     $this->youTubeApiService->transitionState($this->plannedBroadcast, $this->channel, YouTubeEvent::STATE_REMOTE_LIVE);
     $this->stopMonitorStream();
     $this->startBroadcast();
 }