Video texture class, used to create video textures.

视频纹理

层级 (查看完整内容)

属性

_id: number = 0
allowBackground: boolean = false

Whether to allow the video to continue playing in the background。

视频是否允许在后台继续播放。

destroyedImmediately: boolean

Whether to delete the resource immediately when the reference count is 0.

是否在引用计数为0的时候立马删除他

hdrEncodeFormat: HDREncodeFormat

hdr encode format

hdr编码格式

lock?: boolean

Whether to lock the resource, if true, the resource cannot be automatically released.

是否加锁,如果true为不能使用自动释放机制。

name?: string

The name of the resource.

资源名称。

url: string

The URL of the resource.

获取资源的URL地址。

uuid: string

The UUID of the resource.

获取资源的UUID。

DEBUG: boolean = false

Whether the debug mode is enabled.

是否开启调试模式。

访问器

  • get duration(): number
  • 返回 number

    The duration of the video in seconds. Available after the ready event is triggered.

    视频长度(秒)。ready 事件触发后可用。

  • get frameRate(): number
  • 返回 number

    The frame rate of the video texture, which indicates the number of renderings in one second. It only takes effect when useMediaFrameRate is false or the current platform does not support obtaining the video frame rate.

    视频纹理更新帧率,表示一秒内的渲染次数。只有useMediaFrameRate为false或者当前平台不支持获取视频自身帧率时才生效。

  • set frameRate(value): void
  • 参数

    • value: number

    返回 void

  • get frameRender(): boolean
  • 返回 boolean

    Whether to call the render function internally. If not, the user needs to call the render function manually. Default is true.

    是否内部驱动调用render函数。如果否,则需要用户自行调用render函数。默认true。

  • set frameRender(value): void
  • 参数

    • value: boolean

    返回 void

  • get obsolute(): boolean
  • 返回 boolean

    If a cached resource observer is set to true, then:

      1. getRes will still return this resource;
      1. next time loading will ignore this cached resource and reload it.

    如果设置一个已缓存的资源obsolute为true,则

    • 1)getRes仍然可以返回这个资源;
    • 2)下次加载时会忽略这个缓存而去重新加载。。
  • set obsolute(value): void
  • 参数

    • value: boolean

    返回 void

  • get playbackRate(): number
  • 返回 number

    The current playback speed of the audio/video. For example:

    • 1.0: Normal speed
    • 0.5: Half speed (slower)
    • 2.0: Double speed (faster)
    • -1.0: Backwards, normal speed
    • -0.5: Backwards, half speed Note: Only Google Chrome and Safari support the playbackRate property.

    音频/视频的当前播放速度。如:

    • 1.0:正常速度
    • 0.5:半速(更慢)
    • 2.0:倍速(更快)
    • -1.0:向后,正常速度
    • -0.5:向后,半速 注意:只有 Google Chrome 和 Safari 支持 playbackRate 属性。
  • set playbackRate(value): void
  • 参数

    • value: number

    返回 void

  • get readyState(): number
  • 返回 number

    The readiness state of the video element:

    • 0 = HAVE_NOTHING - No information is available about the audio/video
    • 1 = HAVE_METADATA - Metadata for the audio/video is ready
    • 2 = HAVE_CURRENT_DATA - Data for the current playback position is available, but not enough to play the next frame/millisecond
    • 3 = HAVE_FUTURE_DATA - Data for the current and at least the next frame is available
    • 4 = HAVE_ENOUGH_DATA - Enough data is available to start playing

    视频元素的就绪状态:

    • 0 = HAVE_NOTHING - 没有关于音频/视频是否就绪的信息
    • 1 = HAVE_METADATA - 关于音频/视频就绪的元数据
    • 2 = HAVE_CURRENT_DATA - 关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒
    • 3 = HAVE_FUTURE_DATA - 当前及至少下一帧的数据是可用的
    • 4 = HAVE_ENOUGH_DATA - 可用数据足以开始播放
  • get videoHeight(): number
  • 返回 number

    The height of the video source. Available after the ready event is triggered.

    视频源高度。ready 事件触发后可用。

  • get videoWidth(): number
  • 返回 number

    The width of the video source. Available after the ready event is triggered.

    视频源宽度。ready 事件触发后可用。

方法

  • 参数

    • count: number = 1

      The amount by which to increment the reference count, default is 1.

    返回 void

    Increments the reference count of the resource by the specified amount.

    按指定数量增加资源的引用计数。

  • 参数

    • count: number = 1

      The amount by which to decrement the reference count, default is 1.

    返回 void

    Decrements the reference count of the resource by the specified amount. If the reference count reaches zero and certain conditions are met, the resource may be destroyed.

    按指定数量减少资源的引用计数。如果引用计数达到零并且满足特定条件,资源可能会被销毁。

  • 参数

    • url: string

      The URL used to create the resource.

    • 可选uuid: string

      The optional UUID of the resource.

    返回 void

    Sets the URL and UUID used to create this resource.

    设置用于创建此资源的 URL 和 UUID。

  • 参数

    • type: string

      Video format type, such as "mp4", "ogg", "webm", "m3u8", etc.

    返回 CanPlayTypeResult

    The level of support. Possible values:

    • "probably": The browser most likely supports this audio/video type
    • "maybe": The browser might support this audio/video type
    • "": (empty string) The browser does not support this audio/video type

    Check if the specified video format is supported for playback

    检测是否支持播放指定格式视频

  • 参数

    • type: string

      The type of event.

    • 可选data: any

      (Optional) Data to pass to the callback. If multiple parameters p1, p2, p3, ... need to be passed, use an array structure such as [p1, p2, p3, ...]. If a single parameter p needs to be passed and p is an array, use a structure such as [p]. For other single parameters p, you can directly pass parameter p. If data is Event.EMPTY, it means passing an Event object to the callback function. Note that it is not passing Event.TEMP, but an independent Event object.

    返回 boolean

    True if there are listeners for this event type, false otherwise.

    Dispatch an event.

    派发事件。

  • 参数

    • type: string

      The type of event.

    返回 boolean

    True if a listener of the specified type is registered, false otherwise.

    Check if the EventDispatcher object has any listeners registered for a specific type of event.

    检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。

  • 参数

    • url: string

      The URL to check against the resource's creation URL.

    返回 boolean

    True if the resource is created from the specified URL, otherwise false.

    Checks if the resource is created from the specified URL.

    检查资源是否从指定的 URL 创建。

  • 参数

    • type: string

      The type of event.

    • listener: Function

      The listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知。

  • 参数

    • type: string

      The type of event.

    • caller: any

      The execution scope of the event listener function.

    • listener: Function

      The listener function.

    • 可选args: any[]

      (Optional) The callback parameters of the event listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知。

  • 参数

    • type: string

      The type of event.

    • listener: Function

      The listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications. This event listener responds once and is automatically removed after the first call.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知,此侦听事件响应一次后自动移除。

  • 参数

    • type: string

      The type of event.

    • caller: any

      The execution scope of the event listener function.

    • listener: Function

      The listener function.

    • 可选args: any[]

      (Optional) The callback parameters of the event listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications. This event listener responds once and is automatically removed after the first call.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知,此侦听事件响应一次后自动移除。

  • 返回 VideoTexture

    Create a video texture instance. You need to create a video texture in this way. You cannot directly use the new VideoTexture() method to create it.

    创建一个视频纹理实例,需要通过这种方式创建视频纹理,不能直接使用new VideoTexture()的方式创建。