Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

Commit

Permalink
Add getVideoPlaybackQuality API (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
gesinger authored and mjneil committed Apr 27, 2017
1 parent 39d8d6b commit a6e4fdd
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CHANGELOG
=========

## HEAD (Unreleased)
_(none)_
* Add getVideoPlaybackQuality API

--------------------

Expand Down
3 changes: 3 additions & 0 deletions src/VideoJS.as
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ package{
case "rtmpStream":
return _app.model.rtmpStream;
break;
case "getVideoPlaybackQuality":
return _app.model.videoPlaybackQuality;
break;
}
return null;
}
Expand Down
7 changes: 7 additions & 0 deletions src/com/videojs/VideoJSModel.as
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,13 @@ package com.videojs{
return true;
}

public function get videoPlaybackQuality():Object{
if(_provider){
return _provider.videoPlaybackQuality;
}
return {};
}

/**
* Allows this model to act as a centralized event bus to which other classes can subscribe.
*
Expand Down
5 changes: 5 additions & 0 deletions src/com/videojs/providers/HTTPAudioProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ package com.videojs.providers{
return _metadata;
}

public function get videoPlaybackQuality():Object{
// only meant for video
return {};
}

public function get srcAsString():String{
if(_src != null && _src.path != undefined){
return _src.path;
Expand Down
12 changes: 12 additions & 0 deletions src/com/videojs/providers/HTTPVideoProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,18 @@ package com.videojs.providers{
return _metadata;
}

public function get videoPlaybackQuality():Object{
if (_ns != null &&
_ns.hasOwnProperty('decodedFrames') &&
_ns.info.hasOwnProperty('droppedFrames')) {
return {
droppedVideoFrames: _ns.info.droppedFrames,
totalVideoFrames: _ns.decodedFrames + _ns.info.droppedFrames
};
}
return {};
}

public function set src(pSrc:Object):void{
init(pSrc, false);
}
Expand Down
6 changes: 6 additions & 0 deletions src/com/videojs/providers/IProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ package com.videojs.providers{
*/
function get metadata():Object;

/**
* Should return an object that contains playback quality details, following the
* form of https://w3c.github.io/media-source/#VideoPlaybackQuality
*/
function get videoPlaybackQuality():Object;

/**
* Should return the most reasonable string representation of the current assets source location.
*/
Expand Down
12 changes: 12 additions & 0 deletions src/com/videojs/providers/RTMPVideoProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ package com.videojs.providers{
return _metadata;
}

public function get videoPlaybackQuality():Object{
if (_ns != null &&
_ns.hasOwnProperty('decodedFrames') &&
_ns.info.hasOwnProperty('droppedFrames')) {
return {
droppedVideoFrames: _ns.info.droppedFrames,
totalVideoFrames: _ns.decodedFrames + _ns.info.droppedFrames
};
}
return {};
}

public function set src(pSrc:Object):void{
_hasDuration = false;
if(_isPlaying){
Expand Down

0 comments on commit a6e4fdd

Please # to comment.