Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Video

A convenience type for showing a specified video More...

Inherits Item

Properties

Signals

Methods

Detailed Description

Video is a convenience type combining the functionality of a MediaPlayer and a VideoOutput into one. It provides simple video playback functionality without having to declare multiple types.

 import QtQuick 2.0
 import QtMultimedia 5.0

 Video {
     id: video
     width : 800
     height : 600
     source: "video.avi"

     MouseArea {
         anchors.fill: parent
         onClicked: {
             video.play()
         }
     }

     focus: true
     Keys.onSpacePressed: video.paused = !video.paused
     Keys.onLeftPressed: video.position -= 5000
     Keys.onRightPressed: video.position += 5000
 }

Video supports untransformed, stretched, and uniformly scaled video presentation. For a description of stretched uniformly scaled presentation, see the fillMode property description.

Screen Saver

If it is likely that an application will be playing video for an extended period of time without user interaction, it may be necessary to disable the platform's screen saver. The ScreenSaver (from QtSystemInfo) may be used to disable the screensaver in this fashion:

 import QtSystemInfo 5.0

 ScreenSaver { screenSaverEnabled: false }

See also MediaPlayer and VideoOutput.

Property Documentation

autoLoad : bool

This property indicates if loading of media should begin immediately.

Defaults to true, if false media will not be loaded until playback is started.


autoPlay : bool

This property determines whether the media should begin playback automatically.


availability : enumeration

Returns the availability state of the video instance.

This is one of:

ValueDescription
MediaPlayer.AvailableThe video player is available to use.
MediaPlayer.BusyThe video player is usually available, but some other process is utilizing the hardware necessary to play media.
MediaPlayer.UnavailableThere are no supported video playback facilities.
MediaPlayer.ResourceMissingThere is one or more resources missing, so the video player cannot be used. It may be possible to try again at a later time.

bufferProgress : real

This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 (full).


duration : int

This property holds the duration of the media in milliseconds.

If the media doesn't have a fixed duration (a live stream for example) this will be 0.


error : enumeration

This property holds the error state of the video. It can be one of:

  • NoError - there is no current error.
  • ResourceError - the video cannot be played due to a problem allocating resources.
  • FormatError - the video format is not supported.
  • NetworkError - the video cannot be played due to network issues.
  • AccessDenied - the video cannot be played due to insufficient permissions.
  • ServiceMissing - the video cannot be played because the media service could not be instantiated.

errorString : string

This property holds a string describing the current error condition in more detail.


fillMode : enumeration

Set this property to define how the video is scaled to fit the target area.

  • VideoOutput.Stretch - the video is scaled to fit
  • VideoOutput.PreserveAspectFit - the video is scaled uniformly to fit without cropping
  • VideoOuput.PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary

Because this type is for convenience in QML, it does not support enumerations directly, so enumerations from VideoOuput are used to access the available fill modes.

The default fill mode is preserveAspectFit.


hasAudio : bool

This property holds whether the current media has audio content.


hasVideo : bool

This property holds whether the current media has video content.


metaData : alias


muted : bool

This property holds whether the audio output is muted.


orientation : int

The orientation of the Video in degrees. Only multiples of 90 degrees is supported, that is 0, 90, 180, 270, 360, etc.


playbackRate : real

This property holds the rate at which video is played at as a multiple of the normal rate.


playbackState : enumeration

This read only property indicates the playback state of the media.

The default state is MediaPlayer.StoppedState.


position : int

This property holds the current playback position in milliseconds.


seekable : bool

This property holds whether the playback position of the video can be changed.


source : url

This property holds the source URL of the media.


status : enumeration

This property holds the status of media loading. It can be one of:

  • NoMedia - no media has been set.
  • Loading - the media is currently being loaded.
  • Loaded - the media has been loaded.
  • Buffering - the media is buffering data.
  • Stalled - playback has been interrupted while the media is buffering data.
  • Buffered - the media has buffered data.
  • EndOfMedia - the media has played to the end.
  • InvalidMedia - the media cannot be played.
  • UnknownStatus - the status of the media cannot be determined.

volume : real

This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume).


Signal Documentation

Video::paused()

This signal is emitted when playback is paused.


Video::playbackStateChanged()

This signal is emitted whenever the state of playback changes.


Video::playing()

This signal is emitted when playback is started or continued.


Video::stopped()

This signal is emitted when playback is stopped.


Method Documentation

Video::pause()

Pauses playback of the media.


Video::play()

Starts playback of the media.


Video::stop()

Stops playback of the media.


Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web