-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(android): Progress report for Media plugin (CB-7175) #22
base: master
Are you sure you want to change the base?
Changes from 2 commits
b98eb39
7c77883
bdbef09
ce07ef3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,15 +36,18 @@ var mediaObjects = {}; | |
* errorCallback(int errorCode) - OPTIONAL | ||
* @param statusCallback The callback to be called when media status has changed. | ||
* statusCallback(int statusCode) - OPTIONAL | ||
* @param bufferedCallback The callback to be called when media has progressed buffering. | ||
* bufferedCallback(int bufferedPercentage) - OPTIONAL | ||
*/ | ||
var Media = function(src, successCallback, errorCallback, statusCallback) { | ||
argscheck.checkArgs('SFFF', 'Media', arguments); | ||
var Media = function(src, successCallback, errorCallback, statusCallback, bufferedCallback) { | ||
argscheck.checkArgs('SFFFF', 'Media', arguments); | ||
this.id = utils.createUUID(); | ||
mediaObjects[this.id] = this; | ||
this.src = src; | ||
this.successCallback = successCallback; | ||
this.errorCallback = errorCallback; | ||
this.statusCallback = statusCallback; | ||
this.bufferedCallback = bufferedCallback; | ||
this._duration = -1; | ||
this._position = -1; | ||
exec(null, this.errorCallback, "Media", "create", [this.id, this.src]); | ||
|
@@ -192,4 +195,16 @@ Media.onStatus = function(id, msgType, value) { | |
|
||
}; | ||
|
||
module.exports = Media; | ||
Media.onBuffered = function(id, buffered) { | ||
var media = mediaObjects[id]; | ||
|
||
if(media) { | ||
media.bufferedCallback && media.bufferedCallback(buffered); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the indentation here doesn't match the indentation of the else block below. |
||
} | ||
else { | ||
console.error && console.error("Received Media.onBuffered callback for unknown media :: " + id); | ||
} | ||
|
||
}; | ||
|
||
module.exports = Media; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the red null w/ red linefeed means you don't have a newline at the end of your file. please add one. Also, please file a bug in issues.apache.org/jira and reference it in the commit message (see the contribution guide...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that reached the end of file
sounds wrong... based on the callback name.