本文整理匯總了TypeScript中ionic-native.NativeAudio類的典型用法代碼示例。如果您正苦於以下問題:TypeScript NativeAudio類的具體用法?TypeScript NativeAudio怎麽用?TypeScript NativeAudio使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了NativeAudio類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: stopMusic
stopMusic() {
this.musicPlayed = false;
this.configServ.setMusicPlayed(this.musicPlayed);
NativeAudio.stop('sparkle').then(
() => {console.log('Stop audio');},
(err) => {console.log(err);}
);
}
示例2: playMusic
playMusic() {
this.musicPlayed = true;
this.configServ.setMusicPlayed(this.musicPlayed);
NativeAudio.loop('sparkle').then(
() => {console.log('Play audio');},
(err) => {console.log(err);}
);
}
示例3: touch
touch() {
try {
if (this.isPlay()) {
NativeAudio.play('touch');
}
} catch (error) {
console.error('touch', error);
}
}
示例4: catch
this.platform.ready().then(() => {
try {
GoogleAnalytics.startTrackerWithId('UA-64143538-11');
} catch (error) {
console.error('GoogleAnalytics: ' + error);
}
NativeAudio.preloadSimple('touch', 'assets/audio/touch.mp3')
.then(() => this.isInit = true);
});
示例5: preloadMusic
preloadMusic() {
NativeAudio.preloadComplex('sparkle', 'assets/audio/sparkle-piano.mp3', 1, 1, 0).then(
() => {console.log('Preload audio');},
(err) => {console.log(err);}
);
}