js/audio.js
changeset 0 54063d8b0412
equal deleted inserted replaced
-1:000000000000 0:54063d8b0412
       
     1 /**
       
     2  * This class provides access to the device media, interfaces to both sound and video
       
     3  * @constructor
       
     4  */
       
     5 function Audio(src, successCallback, errorCallback) {
       
     6 	this.src = src;
       
     7 	this.successCallback = successCallback;
       
     8 	this.errorCallback = errorCallback;												
       
     9 }
       
    10 
       
    11 Audio.prototype.record = function() {
       
    12 };
       
    13 
       
    14 Audio.prototype.play = function() {
       
    15 try {
       
    16 	if (document.getElementById('gapsound'))
       
    17 		document.body.removeChild(document.getElementById('gapsound'));
       
    18 	var obj;
       
    19 	obj = document.createElement("embed");
       
    20 	obj.setAttribute("id", "gapsound");
       
    21 	obj.setAttribute("type", "audio/x-mpeg");
       
    22 	obj.setAttribute("width", "0");
       
    23 	obj.setAttribute("width", "0");
       
    24 	obj.setAttribute("hidden", "true");
       
    25 	obj.setAttribute("autostart", "true");
       
    26 	obj.setAttribute("src", this.src);
       
    27 	document.body.appendChild(obj);
       
    28 } catch (ex) { debug.log(ex.name + ": " + ex.message); }
       
    29 };
       
    30 
       
    31 Audio.prototype.pause = function() {
       
    32 };
       
    33 
       
    34 Audio.prototype.stop = function() {
       
    35 	document.body.removeChild(document.getElementById('gapsound'));
       
    36 };