/** * Test the isBroadcasting method */ public function testIsBroadcasting() { /* Create a running broadcast with string values as id's */ $running = new RunningBroadcast('5', '2', '6', 'test'); $liveBroadcast = $this->getLiveBroadcast(5); $channel = $this->getChannelTwitch(6); self::assertTrue($running->isBroadcasting($liveBroadcast, $channel)); $liveBroadcast = $this->getLiveBroadcast(7); self::assertFalse($running->isBroadcasting($liveBroadcast, $channel)); $liveBroadcast = $this->getLiveBroadcast(5); $channel = $this->getChannelTwitch(8); self::assertFalse($running->isBroadcasting($liveBroadcast, $channel)); $running = new RunningBroadcast(5, 2, 8, 'test'); self::assertTrue($running->isBroadcasting($liveBroadcast, $channel)); }
/** * Retrieve what is broadcasting. * * @return RunningBroadcast[] */ protected function updateRunningBroadcasts() { $this->runningBroadcasts = array(); $this->logger->debug('Retrieve running broadcasts'); $processStrings = $this->schedulerCommands->getRunningProcesses(); foreach ($processStrings as $processString) { $runningItem = new RunningBroadcast($this->schedulerCommands->getBroadcastId($processString), $this->schedulerCommands->getProcessId($processString), $this->schedulerCommands->getChannelId($processString), $this->schedulerCommands->getEnvironment($processString), $this->schedulerCommands->isMonitorStream($processString)); if ($runningItem->isValid($this->schedulerCommands->getKernelEnvironment())) { $this->runningBroadcasts[] = $runningItem; } } return $this->runningBroadcasts; }
/** * Stop a monitor stream */ protected function stopMonitorStream() { $this->logger->info('YouTube stop monitor stream', array('broadcast_id' => $this->monitorBroadcast->getBroadcastId())); $this->command->stopProcess($this->monitorBroadcast->getProcessId()); }