VideoPlaybackQuality.totalVideoFrames

videoPlaybackQuality的totalVideoFrames属性为一个只读属性,用于表述已经被加载的媒体资源中已经被渲染播放或者被废弃的视频帧总数

Syntax

value = videoPlaybackQuality.totalVideoFrames;

Value

video容器已经被加载的媒体资源中已经被渲染播放或者被废弃的视频帧总数,本质上讲,这个总数是指没有发生播放异常问题下的数目。

Example

下面的例子想要表述的是通过已经丢弃(丢帧)或者播放异常的帧数总和占totalVideoFrames的比例超过10%,则触发一个例如名为lostFramesThresholdExceeded的回调函数以反应我们当前视频资源丢帧已经播放异常的程度,从而帮助业务进行调整

var videoElem = document.getElementById("my_vid");
var quality = videoElem.getVideoPlaybackQuality();

if ((quality.corruptedVideoFrames + quality.droppedVideoFrames)/quality.totalVideoFrames > 0.1) {
  lostFramesThresholdExceeded();
}
触发回调函数后,我们可以使用一些算法来尝试切换到需要较少带宽,码率低的,较低分辨率视频,以避免丢帧。

Specifications

Specification Status Comment
Media Playback Quality
VideoPlaybackQuality.totalVideoFrames
Editor's Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
totalVideoFrames
Experimental
Chrome Full support 23Edge Full support 12Firefox Full support 42
Full support 42
No support 25 — 42
Notes Disabled
Notes Limited support to a whitelist of sites, for example YouTube, Netflix, and other popular streaming sites. The whitelist was removed when Media Source Extensions was enabled by default in Firefox 42.
Disabled From version 25 until version 42 (exclusive): this feature is behind the media.mediasource.enabled preference. To change preferences in Firefox, visit about:config.
IE Full support 11
Notes
Full support 11
Notes
Notes Only works on Windows 8+.
Opera Full support 15Safari Full support 8WebView Android Full support 4.4.3Chrome Android ? Firefox Android No support NoOpera Android Full support 14Safari iOS No support NoSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.

See also