Video

From MegaZine3
Jump to: navigation, search

The vid element is used to load videos (FLV, F4V). As of Update 3 for FlashPlayer 9 it is also possible to load h.264 encoded videos if using one of the following container formats: MP4, M4A, MOV, MPV4, 3GP, and 3G2. More information at Adobe's webpage.

Contents

Attributes

aa

Determines whether to use anti aliasing (smoothing) for the video. This can result in noticeably improved quality of the video while dragging a page or zooming. Can have a high impact on performance, though.

autoplay

Determines whether to automatically start video playback as soon as a context where it may play is entered (i.e. when it's on a visible page if nopause is false, and on the main page if onlywhenactive is true).
Attention: If the attribute restart is set to 'true', this overrules autoplay='false' and will start the video immediately.

delay

Time in milliseconds before the sound starts fading in and video playback is started. This does not affect fadeout, which will still begin immediately if the containing page becomes invisible.

fade

Time in milliseconds over which to fade in and out the sound of the video when the containing page becomes visible or hidden, respectively.

gui

Absolute or relative path to the gui file to use (playback controls). Relative paths are always relative to the megazine.swf file. A default gui is delivered with the other elements, called vidgui.swf. To use it, add gui="elements/vidgui.swf" in the vid tag.

guicolor

Color overlay of the playback controls as an RGB or ARGB value. If no alpha value is given alpha will be 0.75.

height

The height of the element. If not given, uses the actual size of the loaded element. If the given value is smaller than 1 the size is interpreted to be relative to the actual size, i.e. the loaded element is scaled by that factor.

loop

Determines whether the video runs in an infinite loop or is played only once, and must then be started again manually (e.g. via playback controls defined in gui).

nopause

Normally videos are paused when the containing page is not visible, to save performance. This setting can be used to override this behavior. When using many videos, though, this can have a heavy impact on performance!

onlywhenactive

When set to true, playback may only commence once the containing page is the main / current page. Normally playback can begin once the page is visible, i.e. even if it is just visible because the user lifts the corner of the page hiding the containing page.

preview

Path to an image to display which has to be clicked by the user before loading the actual video. This way the initial page loading will be sped up, and less bandwidth will be wasted if the user is not interested in the video.

The image will be loaded into an ASUL element defined in the megazine.asul file (id vidpreview). Per default this will overlay the image with a play button, to hint the user has to click first to play the video.

restart

When set to true, instead of continuing the playback when the user returns to the containing page, the video is restarted, i.e. playback begins anew at the beginning.
The video also is started immediately when it becomes active/visible; independent on the settings of the autplay attribute.

stoptopreview

To allow reverting to preview image when stopping a video.

src

Absolute or relative path to the video file to load. Relative paths are (normally) relative to the megazine.swf file.

width

The width of the element. If not given, uses the actual size of the loaded element. If the given value is smaller than 1 the size is interpreted to be relative to the actual size, i.e. the loaded element is scaled by that factor.

Examples

<book>
    <chapter>
        <page>
            <vid src="data/video.f4v" position="middle center"
                 onlywhenactive="true" gui="elements/vidgui.swf"
                 preview="data/video_preview.jpg"/>
        </page>
        <!-- ... -->
    </chapter>
</book>
MegaZine3 Core-related articles
Book elements Book · Chapter · Page · Spreadpage
Page elements Area · GIF · Image · Navigation · Sound · Text · Video
Personal tools
Namespaces
Variants
Actions
Navigation
documentation
miscellaneous
Toolbox