/** * Get the output parameters for streaming. * * @return string * @throws LiveBroadcastOutputException */ public function generateOutputCmd() { if (!$this->channel instanceof ChannelTwitch || empty($this->channel->getStreamKey()) || empty($this->channel->getStreamServer())) { throw new LiveBroadcastOutputException(__FUNCTION__ . ' Twitch channel not configured'); } return sprintf('-vcodec copy -acodec copy -f flv "rtmp://%s/app/%s"', $this->channel->getStreamServer(), $this->channel->getStreamKey()); }
/** * Test if the correct output instance is returned for a given channel */ public function testGetOutputInterface() { $outputFacebook = new OutputFacebook(); $outputTwitch = new OutputTwitch(); $channelTwitch = new ChannelTwitch(); $channelTwitch->setStreamKey('key'); $channelTwitch->setStreamServer('server'); $service = new StreamOutputService(); $service->addStreamOutput($outputFacebook, 'Facebook'); $service->addStreamOutput($outputTwitch, 'Twitch'); $twitch = $service->getOutputInterface($channelTwitch); self::assertEquals('-vcodec copy -acodec copy -f flv "rtmp://server/app/key"', $twitch->generateOutputCmd()); }
/** * Setup a testable Twitch channel. */ public function setUp() { $this->twitchChannel = new ChannelTwitch(); $this->twitchChannel->setStreamServer('value1'); $this->twitchChannel->setStreamKey('value2'); }
/** * Test the isEntityConfigured method */ public function testIsEntityConfigured() { $channel = new ChannelTwitch(); $configuration = array(); self::assertTrue($channel->isEntityConfigured($configuration)); }