我正在使用離子插件cordova-plugin-media。Ionic 2媒體插件
component.ts
import {Page} from 'ionic-framework/ionic';
declare var Media:any;
@Page({
templateUrl: 'build/pages/settings/offline.html',
})
export class TestPage {
audio;
constructor() {
this.audio = new Media('https://firebasestorage.googleapis.com/v0/b/apartments-ea9e5.appspot.com/o/Loud-Ringtone-11-Emergency-Alert.mp3?alt=media&token=7d67b437-e96b-484e-bd97-008106a06dcb');
this.audio.play();
}
}
我怎麼能播放和停止音頻文件?
我目前收到此錯誤。
ReferenceError: Media is not defined .
謝謝你的回覆。第一次只播放音頻文件。第二次音頻文件不能播放爲什麼..你可以幫我 – ANISUNDAR
我收到這個錯誤。我用this.audio.stop();和this.audio.play()。不能讀屬性'play'的undefined – ANISUNDAR