Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Skip to end of metadata
Go to start of metadata

This FieldType represents and handles media (audio/video) binary file.

NameInternal nameExpected input
Mediaezmediamixed

Table of contents:

Description

This FieldType represents and handles media (audio/video) binary file.

It is capable of handling following types of files:

  • Apple QuickTime
  • Adobe Flash
  • Microsoft Windows Media
  • Real Media
  • Silverlight
  • HTML5 Video
  • HTML5 Audio

Input expectations

TypeDescriptionExample
stringPath to the media file./Users/jane/butterflies.mp4
eZ\Publish\Core\FieldType\Media\ValueMedia FieldType Value Object with path to the media file as the value of id property.See Value object section below.

Value object

Properties

eZ\Publish\Core\FieldType\Media\Value offers the following properties.

Note that both Media and BinaryFile Value and Type inherit from the BinaryBase abstract field type, and share common properties.

PropertyTypeDescriptionExample
idstring

Media file identifier. This ID depends on the IO Handler that is being used. With the native, default handlers (FileSystem and Legacy), the ID is the file path, relative to the binary file storage root dir (var/<vardir>/storage/original by default).

This attribute has been introduced in eZ Publish 5.2.

application/63cd472dd7819da7b75e8e2fee507c68.mp4
fileNamestringThe human readable file name, as exposed to the outside. Used when sending the file for download in order to name the file.butterflies.mp4
fileSizeintFile size, in bytes1077923
mimeTypestringThe file's mime type.

video/mp4

uristring

The binary file's HTTP uri. If the URI doesn't include a host or protocol, it applies to the request domain.

This attribute has been introduced in eZ Publish 5.2.

The URI is not publicly readable, and must NOT be used to link to the file for download. Use ez_render_field to generate a valid link to the download controller.

/var/ezdemo_site/storage/original/application/63cd472dd7819da7b75e8e2fee507c68.mp4
hasControllerboolean

If the media has a controller when being displayed

true
autoplayboolean

If the media should be automatically played

true
loopboolean

If the media should be played in a loop

false
heightint

Height of the media

300
widthint

Width of the media

400
pathstring

deprecated
Renamed to id starting from eZ Publish 5.2. Can still be used, but it is recommended not to use it anymore as it will be removed.

 

Hash format

The hash format mostly matches the value object. It has the following keys:

  • id
  • path (for backwards compatibility)
  • fileName
  • fileSize
  • mimeType
  • uri
  • hasController
  • autoplay
  • loop
  • height
  • width

Validation

The FieldType supports FileSizeValidator, defining maximal size of media file in bytes:

Name
Type
Default value
Description
maxFileSizeintfalseMaximal size of the file in bytes.
Example of using Media FieldType validator in PHP

Settings

The FieldType supports mediaType setting defining how the media file should be handled in output.

Name
Type
Default value
Description
mediaTypemixed
Type::TYPE_HTML5_VIDEO
Type of the media, accepts one of the predefined constants.

List of all available mediaType constants defined in eZ\Publish\Core\FieldType\Media\Type class:

Name
Description
TYPE_FLASH
Adobe Flash
TYPE_QUICKTIME
Apple QuickTime
TYPE_REALPLAYER
Real Media
TYPE_SILVERLIGHT
Silverlight
TYPE_WINDOWSMEDIA

Microsoft Windows Media

TYPE_HTML5_VIDEO
HTML5 Video
TYPE_HTML5_AUDIO

HTML5 Audio

Example of using Media FieldType settings in PHP