-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
FetchVideoSource
in video overlays
- Loading branch information
1 parent
e3ca9f4
commit 830b619
Showing
10 changed files
with
149 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/** | ||
* This file is part of the Cloudinary PHP package. | ||
* | ||
* (c) Cloudinary | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Cloudinary\Transformation; | ||
|
||
use Cloudinary\ClassUtils; | ||
|
||
/** | ||
* Defines how to manipulate a fetched video layer. | ||
* | ||
* **Learn more**: <a | ||
* href=https://cloudinary.com/documentation/video_layers#layer_transformations target="_blank"> | ||
* Video overlays</a> | ||
* | ||
* @api | ||
*/ | ||
class FetchVideoSource extends VideoSource | ||
{ | ||
/** | ||
* VideoLayer constructor. | ||
* | ||
* @param $source | ||
*/ | ||
public function __construct($source) | ||
{ | ||
parent::__construct($source); | ||
|
||
$this->setSource($source); | ||
} | ||
/** | ||
* Sets the source of the layer. | ||
* | ||
* @param string|FetchSourceQualifier $source The source. | ||
* | ||
* @return $this | ||
*/ | ||
public function setSource($source) | ||
{ | ||
|
||
if ($source instanceof FetchSourceQualifier) { | ||
$this->getSourceQualifier()->fetchUrl($source->getValue()); | ||
|
||
return $this; | ||
} | ||
|
||
$this->getSourceQualifier()->fetchUrl((string)$source); | ||
|
||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Gets the layer qualifier. | ||
* | ||
* @return FetchSourceQualifier | ||
* | ||
* @internal | ||
*/ | ||
protected function getSourceQualifier() | ||
{ | ||
if (! isset($this->qualifiers['source'])) { | ||
$this->qualifiers['source'] = (new FetchSourceQualifier(null))->assetType("video"); | ||
} | ||
|
||
return $this->qualifiers['source']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters