jsdk-offical
Version:
JSDK is the most comprehensive TypeScript framework, like JDK.
46 lines (42 loc) • 1.15 kB
text/typescript
/// <reference path='../../dist/jsdk.d.ts' />
JS.imports([
'$jsmedia'
]).then(() => {
let cache = new AudioCache({
name: 'test.audio'
}), a1 = new AudioPro({
played: ()=>{
alert('This audio1 play to end!')
}
}), a2 = new AudioPro({
played: ()=>{
alert('This audio2 play to end!')
}
});
cache.load([{
id: 'a1',
url: 'blueyellow.wav'
},{
id: 'a2',
url: 'clapping-crowd.wav'
}]).then(()=>{
$1('#btnPlay1').on('click', ()=>{
a1.play('a1', cache)
})
$1('#btnStop1').on('click', ()=>{
a1.stop()
})
$1('#range1').on('input', function(this: HTMLInputElement){
a1.volume(parseInt(this.value)/parseInt(this.max))
})
$1('#btnPlay2').on('click', ()=>{
a2.play('a2', cache)
})
$1('#btnStop2').on('click', ()=>{
a2.stop()
})
$1('#range2').on('input', function(this: HTMLInputElement){
a2.volume(parseInt(this.value)/parseInt(this.max))
})
});
})