/** * Start the actual broadcast * @throws LiveBroadcastOutputException * @throws \Martin1982\LiveBroadcastBundle\Exception\LiveBroadcastInputException */ protected function startBroadcast() { $media = $this->plannedBroadcast->getInput(); $input = $this->inputService->getInputInterface($media)->generateInputCmd(); /** @var OutputYouTube $outputService */ $outputService = $this->outputService->getOutputInterface($this->channel); $outputService->setStreamUrl($this->youTubeApiService->getStreamUrl($this->plannedBroadcast, $this->channel)); $output = $outputService->generateOutputCmd(); $this->logger->info('YouTube start broadcast', array('broadcast_id' => $this->plannedBroadcast->getBroadcastId())); $this->command->startProcess($input, $output, array('broadcast_id' => $this->plannedBroadcast->getBroadcastId(), 'channel_id' => $this->channel->getChannelId())); }
/** * Initiate a new broadcast. * * @param LiveBroadcast $broadcast * @param BaseChannel $channel */ protected function startBroadcast(LiveBroadcast $broadcast, BaseChannel $channel) { try { $input = $this->inputService->getInputInterface($broadcast->getInput()); $output = $this->outputService->getOutputInterface($channel); $preBroadcastEvent = new PreBroadcastEvent($broadcast, $output); $this->dispatcher->dispatch(PreBroadcastEvent::NAME, $preBroadcastEvent); $this->logger->info('Start broadcast', array('broadcast_id' => $broadcast->getBroadcastId(), 'broadcast_name' => $broadcast->getName(), 'channel_id' => $channel->getChannelId(), 'channel_name' => $channel->getChannelName(), 'input_cmd' => $input->generateInputCmd(), 'output_cmd' => $output->generateOutputCmd())); $this->schedulerCommands->startProcess($input->generateInputCmd(), $output->generateOutputCmd(), array('broadcast_id' => $broadcast->getBroadcastId(), 'channel_id' => $channel->getChannelId())); $postBroadcastEvent = new PostBroadcastEvent($broadcast, $output); $this->dispatcher->dispatch(PostBroadcastEvent::NAME, $postBroadcastEvent); } catch (LiveBroadcastException $ex) { $this->logger->error('Could not start broadcast', array('broadcast_id' => $broadcast->getBroadcastId(), 'broadcast_name' => $broadcast->getName(), 'exception' => $ex->getMessage())); } }