cordova-android/framework/assets/js/media.js

63 lines
1.2 KiB
JavaScript
Raw Normal View History

/**
* This class provides access to the device media, interfaces to both sound and video
* @constructor
*/
function Media(src, successCallback, errorCallback) {
this.src = src;
this.successCallback = successCallback;
this.errorCallback = errorCallback;
}
Media.prototype.record = function() {
}
Media.prototype.play = function() {
}
Media.prototype.pause = function() {
}
Media.prototype.stop = function() {
}
/**
* This class contains information about any Media errors.
* @constructor
*/
function MediaError() {
this.code = null,
this.message = "";
}
MediaError.MEDIA_ERR_ABORTED = 1;
MediaError.MEDIA_ERR_NETWORK = 2;
MediaError.MEDIA_ERR_DECODE = 3;
MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
//if (typeof navigator.audio == "undefined") navigator.audio = new Media(src);
/**
* This class provides access to the device media, interfaces to both sound and video
* @constructor
*/
Media.prototype.play = function() {
2010-06-09 07:36:07 +08:00
GapAudio.startPlayingAudio(this.src);
}
Media.prototype.stop = function() {
2010-06-09 07:36:07 +08:00
GapAudio.stopPlayingAudio();
}
Media.prototype.startRecord = function() {
2010-06-09 07:36:07 +08:00
GapAudio.startRecordingAudio(this.src);
}
Media.prototype.stopRecordingAudio = function() {
2010-06-09 07:36:07 +08:00
GapAudio.stopRecordingAudio();
}