android - ionic2 流媒体不工作

标签 android angular cordova typescript ionic2

我在 ionic2 应用程序中使用流媒体插件。 这是我的代码:

let option:StreamingAudioOptions = {
          successCallback: () => { console.log('Audio played') },
          errorCallback: (e) => { console.log(JSON.stringify(e,null,2)) }
      }
 this.streamingMedia.playAudio('http://sounddible.com/grab.php?id=2196&type=mp3',option);

errorCallback 返回“找不到类

任何帮助解释这个日志的原因

谢谢。

最佳答案

试试下面的代码:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { StreamingMedia, StreamingAudioOptions } from '@ionic-native/streaming-media';
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController,private streamingMedia: StreamingMedia) {}

      startAudio(){
        let options: StreamingAudioOptions = {
          successCallback: () => { console.log('Video played') },
          errorCallback: (e) => { console.log(JSON.stringify(e,null,2)) },
          initFullscreen:false,
        };
          this.streamingMedia.playAudio('YOUR_URL', options);
      }

关于android - ionic2 流媒体不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48111999/

相关文章:

android - getLongExtra 始终使用 PendingIntent 返回默认值

javascript - Angular 动画: can't find query

javascript - 如何访问 Angular 4中上传文件的类型?

android - Bluetooth LE 应用程序,如何构建跨平台(iOS-Android)?

android - Cordova 网络应用程序

android - 包含标记在运行时在 Xamarin .axml 布局中给出异常

java - Caused by : java. lang.OutOfMemoryError: Failed to allocate a 341712908 byte allocation with 3854436 free bytes and 90MB 直到OOM

android - RecyclerView onListItem点击创建新 Intent

laravel - Angular 2覆盖组件

javascript - Firebase 不适用于 Cordova