VideoTag
class VideoTag extends BaseTag implements VideoTransformationInterface
Generates an HTML <video>
tag with specified attributes, containing <source>
tags for the transformation URLs.
For example:
<video poster="https://res.cloudinary.com/demo/video/upload/dog.jpg">
<source src="https://res.cloudinary.com/demo/video/upload/vc_h265/dog.mp4" type="video/mp4; codecs=hev1">
<source src="https://res.cloudinary.com/demo/video/upload/vc_vp9/dog.webm" type="video/webm; codecs=vp9">
<source src="https://res.cloudinary.com/demo/video/upload/vc_auto/dog.mp4" type="video/mp4">
<source src="https://res.cloudinary.com/demo/video/upload/vc_auto/dog.webm" type="video/webm">
</video>
Properties
Configuration | $config | from BaseTag |
Methods
Image format of the video poster.
Use fetch format transformation ("f_") instead of file extension.
VideoTag constructor.
Imports (merges) the configuration.
Adds a tag class.
Resets tag classes and sets the specified one.
Sets tag attribute.
Sets (multiple) tag attributes.
Deletes tag attribute.
Adds tag content.
Sets the content of the tag to the specified one.
Serializes the tag to string.
Serializes the tag content.
Serializes the tag attributes.
Serializes the tag to string.
Serializes the tag to string.
Creates the video tag of the uploaded video.
Creates the video tag of the fetched (remote) video URL.
Whether to automatically build URLs with multiple CDN sub-domains.
Whether to use secure CDN sub-domain.
The custom domain name to use for building HTTP URLs.
Force HTTPS URLs for resources even if they are embedded in non-secure HTTP pages.
The domain name of the CDN distribution to use for building HTTPS URLs.
Set this parameter to true if you are an Advanced plan user with a private CDN distribution.
Set to true to create a signed Cloudinary URL.
Setting both this and signUrl to true will sign the URL using the first 32 characters of a SHA-256 hash.
Set to true to use shorten asset type.
Set to true to omit type and resource_type in the URL.
Set to false to omit default version string for assets in folders in the delivery URL.
Set to false to omit analytics.
The default video sources of the video tag.
Sets the tag sources.
Creates a new video tag from the provided source and an array of parameters.
Sets the fallback content.
Serializes to json.
Adds (appends) a transformation.
Adds (chains) a transformation action.
Details
$this
videoPosterFormat(string $format)
Image format of the video poster.
$this
useFetchFormat(bool $useFetchFormat = true)
Use fetch format transformation ("f_") instead of file extension.
__construct(string|Video $video, array|null $sources = null, Configuration|string|array|null $configuration = null)
VideoTag constructor.
Configuration
configuration(Configuration|string|array|null $configuration)
Sets the configuration.
BaseTag
importConfiguration(Configuration|string|array|null $configuration)
Imports (merges) the configuration.
BaseTag
addClass(string|array $class)
Adds a tag class.
BaseTag
setClass(string|array $class)
Resets tag classes and sets the specified one.
BaseTag
setAttribute(string $key, mixed $value = null)
Sets tag attribute.
BaseTag
setAttributes(array $attributes)
Sets (multiple) tag attributes.
BaseTag
deleteAttribute(string $key)
Deletes tag attribute.
$this
addContent(mixed $content, mixed $key = null)
Adds tag content.
BaseTag
setContent(mixed $content)
Sets the content of the tag to the specified one.
string
serialize()
Serializes the tag to string.
string
serializeContent(array $additionalContent = [], bool $prependAdditionalContent = false)
Serializes the tag content.
string
serializeAttributes(array $attributes = [])
Serializes the tag attributes.
string
toTag()
Serializes the tag to string.
string
__toString()
Serializes the tag to string.
static VideoTagDeliveryTypeTrait
upload(string|mixed $publicId, Configuration|string|array|null $configuration = null)
Creates the video tag of the uploaded video.
static VideoTagDeliveryTypeTrait
fetch(string $url, Configuration|string|array|null $configuration = null)
Creates the video tag of the fetched (remote) video URL.
$this
cdnSubdomain(bool $cdnSubdomain = true)
Whether to automatically build URLs with multiple CDN sub-domains.
$this
secureCdnSubdomain(bool $secureCdnSubdomain = true)
Whether to use secure CDN sub-domain.
$this
cname(string $cname)
The custom domain name to use for building HTTP URLs.
Relevant only for Advanced plan users that have a private CDN distribution and a custom CNAME.
$this
secure(bool $secure = true)
Force HTTPS URLs for resources even if they are embedded in non-secure HTTP pages.
$this
secureCname(string $secureCname)
The domain name of the CDN distribution to use for building HTTPS URLs.
Relevant only for Advanced plan users that have a private CDN distribution.
$this
privateCdn(bool $privateCdn = true)
Set this parameter to true if you are an Advanced plan user with a private CDN distribution.
$this
signUrl(bool $signUrl = true)
Set to true to create a signed Cloudinary URL.
$this
longUrlSignature(bool $longUrlSignature = true)
Setting both this and signUrl to true will sign the URL using the first 32 characters of a SHA-256 hash.
$this
shorten(bool $shorten = true)
Set to true to use shorten asset type.
$this
useRootPath(bool $useRootPath = true)
Set to true to omit type and resource_type in the URL.
$this
forceVersion(bool $forceVersion = true)
Set to false to omit default version string for assets in folders in the delivery URL.
$this
analytics(bool $analytics = true)
Set to false to omit analytics.
static array
defaultVideoSources()
The default video sources of the video tag.
VideoTag
video(mixed $video, Configuration $configuration = null)
Sets the video of the tag.
$this
sources(array $sourcesDefinitions)
Sets the tag sources.
static VideoTag
fromParams(string $source, array $params = [])
Creates a new video tag from the provided source and an array of parameters.
$this
fallback(string $content)
Sets the fallback content.
$this
poster(string|Image|ImageTransformation $poster)
Sets the poster attribute.
mixed
jsonSerialize()
Serializes to json.
VideoTag
addTransformation(CommonTransformation $transformation)
Adds (appends) a transformation.
Appended transformation is nested.
VideoTag
addAction(BaseAction|BaseQualifier|mixed $action)
Adds (chains) a transformation action.
Constants
SINGLE_QUOTES |
|
DOUBLE_QUOTES |
|
NAME |
|
IS_VOID |
|