Le composant Vidéo Player Dans Unity

Grace au composant "VideoPlayer" d'unity il est très simple de lire une vidéo dans une scène de jeu. Son utilisation est multiple : Créer une cinématique, un cinéma virtuel ou encore diffuser une vidéo sur un écran de Tv dans vos scènes de jeux.

Lire une vidéo dans une scène Unity avec du Code C#

YouTube player

VideoPlayer component Reference

Grace au composant « VideoPlayer » d’unity il est très simple de lire une vidéo dans une scène de jeu. Son utilisation est multiple : Créer une cinématique, un cinéma virtuel ou encore diffuser une vidéo sur un écran de Tv dans vos scènes de jeux.

Dans cette vidéo je vous propose d’apprendre a interagir avec ce composant par le biais du code afin de pouvoir la mettre en pause , ou encore avancer , ou tout simplement détecter la fin de la vidéo.

The Video Player component
The Video Player component

Properties

aspectRatioDefines how the video content will be stretched to fill the target area.
audioOutputModeDestination for the audio embedded in the video.
audioTrackCountNumber of audio tracks found in the data source currently configured. (Read Only)
canSetDirectAudioVolumeWhether direct-output volume controls are supported for the current platform and video format. (Read Only)
canSetPlaybackSpeedWhether the playback speed can be changed. (Read Only)
canSetSkipOnDropWhether frame-skipping to maintain synchronization can be controlled. (Read Only)
canSetTimeWhether current time can be changed using the time or timeFrames property. (Read Only)
canSetTimeSourceWhether the time source followed by the VideoPlayer can be changed. (Read Only)
canStepReturns true if the VideoPlayer can step forward through the video content. (Read Only)
clipThe clip being played by the VideoPlayer.
clockTimeThe clock time that the VideoPlayer follows to schedule its samples. The clock time is expressed in seconds. (Read Only)
controlledAudioTrackCountNumber of audio tracks that this VideoPlayer will take control of.
externalReferenceTimeReference time of the external clock the VideoPlayer uses to correct its drift.
frameThe frame index of the currently available frame in VideoPlayer.texture.
frameCountNumber of frames in the current video content. (Read Only)
frameRateThe frame rate of the clip or URL in frames/second. (Read Only)
heightThe height of the images in the VideoClip, or URL, in pixels. (Read Only)
isLoopingDetermines whether the VideoPlayer restarts from the beginning when it reaches the end of the clip.
isPausedWhether playback is paused. (Read Only)
isPlayingWhether content is being played. (Read Only)
isPreparedWhether the VideoPlayer has successfully prepared the content to be played. (Read Only)
lengthThe length of the VideoClip, or the URL, in seconds. (Read Only)
pixelAspectRatioDenominatorDenominator of the pixel aspect ratio (num:den) for the VideoClip or the URL. (Read Only)
pixelAspectRatioNumeratorNumerator of the pixel aspect ratio (num:den) for the VideoClip or the URL. (Read Only)
playbackSpeedFactor by which the basic playback rate will be multiplied.
playOnAwakeWhether the content will start playing back as soon as the component awakes.
renderModeWhere the video content will be drawn.
sendFrameReadyEventsEnables the frameReady events.
skipOnDropWhether the VideoPlayer is allowed to skip frames to catch up with current time.
sourceThe source that the VideoPlayer uses for playback.
targetCameraCamera component to draw to when VideoPlayer.renderMode is set to either VideoRenderMode.CameraFarPlane or VideoRenderMode.CameraNearPlane.
targetCamera3DLayoutType of 3D content contained in the source video media.
targetCameraAlphaOverall transparency level of the target camera plane video.
targetMaterialPropertyMaterial texture property which is targeted when VideoPlayer.renderMode is set to Video.VideoTarget.MaterialOverride.
targetMaterialRendererRenderer which is targeted when VideoPlayer.renderMode is set to Video.VideoTarget.MaterialOverride
targetTextureRenderTexture to draw to when VideoPlayer.renderMode is set to Video.VideoTarget.RenderTexture.
textureInternal texture in which video content is placed. (Read Only)
timeThe presentation time of the currently available frame in VideoPlayer.texture.
timeReferenceThe clock that the VideoPlayer observes to detect and correct drift.
timeSource[NOT YET IMPLEMENTED] The source used used by the VideoPlayer to derive its current time.
urlThe file or HTTP URL that the VideoPlayer reads content from.
waitForFirstFrameDetermines whether the VideoPlayer will wait for the first frame to be loaded into the texture before starting playback when VideoPlayer.playOnAwake is on.
widthThe width of the images in the VideoClip, or URL, in pixels. (Read Only)

Public Methods

EnableAudioTrackEnable/disable audio track decoding. Only effective when the VideoPlayer is not currently playing.
GetAudioChannelCountThe number of audio channels in the specified audio track.
GetAudioLanguageCodeReturns the language code, if any, for the specified track.
GetAudioSampleRateGets the audio track sampling rate in Hertz.
GetDirectAudioMuteGets the direct-output audio mute status for the specified track.
GetDirectAudioVolumeReturn the direct-output volume for specified track.
GetTargetAudioSourceGets the AudioSource that will receive audio samples for the specified track if VideoPlayer.audioOutputMode is set to VideoAudioOutputMode.AudioSource.
IsAudioTrackEnabledWhether decoding for the specified audio track is enabled. See VideoPlayer.EnableAudioTrack for distinction with mute.
PausePauses the playback and leaves the current time intact.
PlayStarts playback.
PrepareInitiates playback engine preparation.
SetDirectAudioMuteSet the direct-output audio mute status for the specified track.
SetDirectAudioVolumeSet the direct-output audio volume for the specified track.
SetTargetAudioSourceSets the AudioSource that will receive audio samples for the specified track if this audio target is selected with VideoPlayer.audioOutputMode.
StepForwardAdvances the current time by one frame immediately.
StopStops the playback and sets the current time to 0.

Laisser un commentaire

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur la façon dont les données de vos commentaires sont traitées.