Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
391 changes: 347 additions & 44 deletions samples/LiveChannel.php

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/OSS/Model/GetLiveChannelHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public function serializeToXml()
{
throw new OssException("Not implemented.");
}

private $liveRecordList = array();


/**
* @var LiveChannelHistory[]
*/
private $liveRecordList;
}
37 changes: 35 additions & 2 deletions src/OSS/Model/GetLiveChannelInfo.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

namespace OSS\Model;
use OSS\Core\OssException;

/**
* Class GetLiveChannelInfo
* @package OSS\Model
Expand Down Expand Up @@ -37,6 +39,10 @@ public function getPlayListName()
return $this->playlistName;
}

public function getSnapshot(){
return $this->snapshot;
}

public function parseFromXml($strXml)
{
$xml = simplexml_load_string($strXml);
Expand All @@ -45,12 +51,35 @@ public function parseFromXml($strXml)
$this->status = strval($xml->Status);

if (isset($xml->Target)) {
foreach ($xml->Target as $target) {
$target = $xml->Target;
$this->type = strval($target->Type);
$this->fragDuration = strval($target->FragDuration);
$this->fragCount = strval($target->FragCount);
$this->playlistName = strval($target->PlaylistName);
}
}

if (isset($xml->Snapshot)) {
$snapshot = $xml->Snapshot;

$snap = new LiveChannelConfigSnapshot();

if (isset($snapshot->RoleName)){
$snap->setRoleName(strval($snapshot->RoleName));
}

if (isset($snapshot->Interval)){
$snap->setInterval(strval($snapshot->Interval));
}

if (isset($snapshot->DestBucket)){
$snap->setDestBucket(strval($snapshot->DestBucket));
}

if (isset($snapshot->NotifyTopic)){
$snap->setNotifyTopic(strval($snapshot->NotifyTopic));
}

$this->snapshot = $snap;
}
}

Expand All @@ -65,4 +94,8 @@ public function serializeToXml()
private $fragDuration;
private $fragCount;
private $playlistName;
/**
* @var LiveChannelConfigSnapshot|null
*/
private $snapshot;
}
155 changes: 155 additions & 0 deletions src/OSS/Model/ListLiveChannel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?php

namespace OSS\Model;

use OSS\Core\OssException;

/**
* Class ListLiveChannel
*
* The data returned by ListBucketLiveChannels
*
* @package OSS\Model
* @link http://help.aliyun.com/document_detail/oss/api-reference/bucket/GetBucket.html
*/
class ListLiveChannel
{
/**
* @var string
*/
private $prefix;
/**
* @var string
*/
private $marker;
/**
* @var string
*/
private $nextMarker;
/**
* @var string
*/
private $maxKeys;
/**
* @var string
*/
private $isTruncated;
/**
* @var LiveChannelInfo[]
*/
private $liveChannel;

/**
* @return string
*/
public function getPrefix()
{
return $this->prefix;
}

/**
* @return string
*/
public function getMarker()
{
return $this->marker;
}

/**
* @return int
*/
public function getMaxKeys()
{
return $this->maxKeys;
}

/**
* @return mixed
*/
public function getIsTruncated()
{
return $this->isTruncated;
}

/**
* @return string
*/
public function getNextMarker()
{
return $this->nextMarker;
}

/**
* @return LiveChannelInfo[]
*/
public function getChannelList(){
return $this->liveChannel;
}

/**
* @param $channel LiveChannelInfo
*/
public function addLiveChannel($channel){
$this->liveChannel[] = $channel;
}

public function parseFromXml($strXml)
{
$xml = simplexml_load_string($strXml);
if (!isset($xml->Prefix) && !isset($xml->Marker) && !isset($xml->MaxKeys) && !isset($xml->IsTruncated) && !isset($xml->NextMarker) && !isset($xml->LiveChannel)) return;
if (isset($xml->Prefix)){
$this->prefix = strval($xml->Prefix);
}
if (isset($xml->Marker)){
$this->marker = strval($xml->Marker);
}
if (isset($xml->MaxKeys)){
$this->maxKeys = strval($xml->MaxKeys);
}
if (isset($xml->IsTruncated)){
$this->isTruncated = strval($xml->IsTruncated);
}
if (isset($xml->NextMarker)){
$this->nextMarker = strval($xml->NextMarker);
}
if (isset($xml->LiveChannel)){
$this->parseLiveChannel($xml->LiveChannel);
}

}

/**
* @param $xmlLiveChannel \SimpleXMLElement
*/
private function parseLiveChannel($xmlLiveChannel){
if (isset($xmlLiveChannel)){
foreach ($xmlLiveChannel as $liveChannel){
$liveChannelInfo = new LiveChannelInfo();
if (isset($liveChannel->Name)){
$liveChannelInfo->setName(strval($liveChannel->Name));
}
if (isset($liveChannel->Description)){
$liveChannelInfo->setDescription(strval($liveChannel->Description));
}
if (isset($liveChannel->Status)){
$liveChannelInfo->setStatus(strval($liveChannel->Status));
}
if (isset($liveChannel->LastModified)){
$liveChannelInfo->setLastModified(strval($liveChannel->LastModified));
}
if (isset($liveChannel->PublishUrls)) {
foreach ($liveChannel->PublishUrls as $url) {
$liveChannelInfo->addPublishUrls(strval($url->Url));
}
}
if (isset($liveChannel->PlayUrls)) {
foreach ($liveChannel->PlayUrls as $url) {
$liveChannelInfo->addPlayUrls(strval($url->Url));
}
}
$this->addLiveChannel($liveChannelInfo);
}

}
}
}
Loading