嗨,我正在 Cordova 开发一个混合应用程序。我想从应用程序中重现音频。我使用以下方法获得了错误:
- html中的音频标签
- 音频 javascript 对象
- 离子原生音频
我也尝试下载文件并复制它,但是当我可以下载时,我只能在某个文件夹上复制文件,只能复制其他文件夹。
编辑 一些代码:如果我从 chrome 或 firefox 或 VLC 打开 url,我可以正确听到声音 Il browser non supporta l'audio
Javascript代码:和上面的url是一样的
this.stream = new Audio(url);
this.stream.addEventListener('playing', (data) => {
console.log(data);
});
this.stream.addEventListener('error', (error) => {
console.log(error);
});
this.stream.play();
在控制台中我获得:
Event {isTrusted: true, type: "playing", target: audio, currentTarget: audio, eventPhase: 2…}bubbles: falsecancelBubble: falsecancelable: truecurrentTarget: nulldefaultPrevented: falseeventPhase: 0isTrusted: trueisTrusted: truepath: Array[1]returnValue: truesrcElement: nulltarget: nulltimeStamp: 5007452.3950000005type: "playing"__proto__: Event
francesca-player.ts:35
Event {isTrusted: true, type: "error", target: audio, currentTarget: audio, eventPhase: 2…}bubbles: falsecancelBubble: falsecancelable: truecurrentTarget: nulldefaultPrevented: falseeventPhase: 0isTrusted: trueisTrusted: truepath: Array[1]returnValue: truesrcElement: nulltarget: nulltimeStamp: 5008322.655000001type: "error"__proto__: EventAT_TARGET: 2BLUR: 8192BUBBLING_PHASE: 3CAPTURING_PHASE: 1CHANGE: 32768CLICK: 64DBLCLICK: 128DRAGDROP: 2048FOCUS: 4096KEYDOWN: 256KEYPRESS: 1024KEYUP: 512MOUSEDOWN: 1MOUSEDRAG: 32MOUSEMOVE: 16MOUSEOUT: 8MOUSEOVER: 4MOUSEUP: 2NONE: 0SELECT: 16384bubbles: (...)get bubbles: ()cancelBubble: (...)get cancelBubble: ()set cancelBubble: ()cancelable: (...)get cancelable: ()constructor: Event()currentTarget: (...)get currentTarget: ()defaultPrevented: (...)get defaultPrevented: ()eventPhase: (...)get eventPhase: ()initEvent: initEvent()path: (...)get path: ()preventDefault: preventDefault()returnValue: (...)get returnValue: ()set returnValue: ()srcElement: (...)get srcElement: ()stopImmediatePropagation: stopImmediatePropagation()stopPropagation: stopPropagation()target: (...)get target: ()timeStamp: (...)get timeStamp: ()type: (...)get type: ()Symbol(Symbol.toStringTag): "Event"__proto__: Object
有人可以帮助我吗?丹尼尔