本文整理汇总了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);}
);
}