/**
  * 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()));
 }
コード例 #2
0
 /**
  * Test the isEntityConfigured method
  */
 public function testIsEntityConfigured()
 {
     $channel = new ChannelYouTube();
     $configuration = array();
     self::assertFalse($channel->isEntityConfigured($configuration));
     $configuration['youtube'] = array();
     self::assertFalse($channel->isEntityConfigured($configuration));
     $configuration['youtube']['client_id'] = null;
     self::assertFalse($channel->isEntityConfigured($configuration));
     $configuration['youtube']['client_secret'] = null;
     self::assertFalse($channel->isEntityConfigured($configuration));
     $configuration['youtube']['redirect_route'] = null;
     self::assertFalse($channel->isEntityConfigured($configuration));
     $configuration['youtube']['client_id'] = 'id';
     self::assertFalse($channel->isEntityConfigured($configuration));
     $configuration['youtube']['client_secret'] = 'secret';
     self::assertFalse($channel->isEntityConfigured($configuration));
     $configuration['youtube']['redirect_route'] = 'route';
     self::assertTrue($channel->isEntityConfigured($configuration));
 }
コード例 #3
0
 /**
  * @param LiveBroadcast  $liveBroadcast
  * @param ChannelYouTube $channel
  * @param string $status
  *
  * @return \Google_Service_YouTube_LiveBroadcast
  */
 protected function setupLivestream(LiveBroadcast $liveBroadcast, ChannelYouTube $channel, $status = 'public')
 {
     $this->getAccessToken($channel->getRefreshToken());
     $broadcastResponse = $this->updateBroadcast($liveBroadcast, $status);
     $streamsResponse = $this->createStream($liveBroadcast->getName());
     // Bind Broadcast and Stream
     $bindBroadcastResponse = $this->youTubeApiClient->liveBroadcasts->bind($broadcastResponse->getId(), 'id,contentDetails', array('streamId' => $streamsResponse->getId()));
     return $bindBroadcastResponse;
 }