ListBucketLiveChannels接口返回数据
Inheritance: implements OSS\Model\XmlConfig
コード例 #1
0
 protected function parseDataFromResponse()
 {
     $content = $this->rawResponse->body;
     $channelList = new LiveChannelListInfo();
     $channelList->parseFromXml($content);
     return $channelList;
 }
コード例 #2
0
 public function testLiveChannelList()
 {
     $list = new LiveChannelListInfo();
     $list->parseFromXml($this->list);
     $this->assertEquals('xxx', $list->getPrefix());
     $this->assertEquals('yyy', $list->getMarker());
     $this->assertEquals(100, $list->getMaxKeys());
     $this->assertEquals(false, $list->getIsTruncated());
     $this->assertEquals('121312132', $list->getNextMarker());
     $channels = $list->getChannelList();
     $this->assertEquals(2, count($channels));
     $chan1 = $channels[0];
     $this->assertEquals('12123214323431', $chan1->getName());
     $this->assertEquals('xxx', $chan1->getDescription());
     $this->assertEquals('enabled', $chan1->getStatus());
     $this->assertEquals('2015-11-24T14:25:31.000Z', $chan1->getLastModified());
     $pubs = $chan1->getPublishUrls();
     $this->assertEquals(1, count($pubs));
     $this->assertEquals('rtmp://bucket.oss-cn-hangzhou.aliyuncs.com/live/1', $pubs[0]);
     $plays = $chan1->getPlayUrls();
     $this->assertEquals(1, count($plays));
     $this->assertEquals('http://bucket.oss-cn-hangzhou.aliyuncs.com/1/播放列表.m3u8', $plays[0]);
     $chan2 = $channels[1];
     $this->assertEquals('432423432423', $chan2->getName());
     $this->assertEquals('yyy', $chan2->getDescription());
     $this->assertEquals('enabled', $chan2->getStatus());
     $this->assertEquals('2016-11-24T14:25:31.000Z', $chan2->getLastModified());
     $pubs = $chan2->getPublishUrls();
     $this->assertEquals(1, count($pubs));
     $this->assertEquals('rtmp://bucket.oss-cn-hangzhou.aliyuncs.com/live/2', $pubs[0]);
     $plays = $chan2->getPlayUrls();
     $this->assertEquals(1, count($plays));
     $this->assertEquals('http://bucket.oss-cn-hangzhou.aliyuncs.com/2/播放列表.m3u8', $plays[0]);
 }