Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
82
gaia/dev_apps/uitest/js/API/openaudio.js
Executable file
82
gaia/dev_apps/uitest/js/API/openaudio.js
Executable file
|
|
@ -0,0 +1,82 @@
|
|||
var open = document.getElementById('open');
|
||||
var opensavefile = document.getElementById('opensavefile');
|
||||
var opensaveblob = document.getElementById('opensaveblob');
|
||||
open.hidden = true;
|
||||
opensavefile.hidden = true;
|
||||
opensaveblob.hidden = true;
|
||||
|
||||
open.onclick = function() {
|
||||
var a = new MozActivity({
|
||||
name: 'open',
|
||||
data: {
|
||||
type: 'audio/ogg',
|
||||
blob: localblob,
|
||||
title: 'jonobacon-freesoftwaresong2.ogg'
|
||||
}
|
||||
});
|
||||
a.onsuccess = function() {
|
||||
console.log('activity returns', JSON.stringify(a.result));
|
||||
};
|
||||
};
|
||||
|
||||
opensavefile.onclick = function() {
|
||||
var a = new MozActivity({
|
||||
name: 'open',
|
||||
data: {
|
||||
type: 'audio/ogg',
|
||||
blob: localblob,
|
||||
allowSave: true,
|
||||
filename: 'downloads/uitest/jonobacon-freesoftwaresong2.ogg'
|
||||
}
|
||||
});
|
||||
a.onsuccess = function() {
|
||||
console.log('activity returns', JSON.stringify(a.result));
|
||||
};
|
||||
};
|
||||
|
||||
opensaveblob.onclick = function() {
|
||||
var a = new MozActivity({
|
||||
name: 'open',
|
||||
data: {
|
||||
type: 'audio/ogg',
|
||||
blob: remoteblob,
|
||||
allowSave: true,
|
||||
filename: 'downloads/uitest/Back_In_Black-sample.ogg'
|
||||
}
|
||||
});
|
||||
a.onsuccess = function() {
|
||||
console.log('activity returns', JSON.stringify(a.result));
|
||||
};
|
||||
};
|
||||
|
||||
// The audio we want to open
|
||||
var localblob;
|
||||
var remoteblob;
|
||||
var localURL = '../../data/audio/jonobacon-freesoftwaresong2.ogg';
|
||||
var remoteURL = 'http://upload.wikimedia.org/wikipedia/en/4/45/' +
|
||||
'ACDC_-_Back_In_Black-sample.ogg';
|
||||
|
||||
var localxhr = new XMLHttpRequest();
|
||||
localxhr.open('GET', localURL);
|
||||
localxhr.responseType = 'blob';
|
||||
localxhr.send();
|
||||
localxhr.onload = function() {
|
||||
localblob = new Blob([localxhr.response], { type: 'audio/ogg' });
|
||||
open.hidden = false;
|
||||
opensavefile.hidden = false;
|
||||
};
|
||||
localxhr.onerror = function() {
|
||||
console.log('Error loading test audio', localxhr.error.name);
|
||||
};
|
||||
|
||||
var remotexhr = new XMLHttpRequest();
|
||||
remotexhr.open('GET', remoteURL);
|
||||
remotexhr.responseType = 'blob';
|
||||
remotexhr.send();
|
||||
remotexhr.onload = function() {
|
||||
remoteblob = new Blob([remotexhr.response], { type: 'audio/ogg' });
|
||||
opensaveblob.hidden = false;
|
||||
};
|
||||
remotexhr.onerror = function() {
|
||||
console.log('Error loading test audio from network', remotexhr.error.name);
|
||||
};
|
||||
Loading…
Reference in a new issue