简体   繁体   English

ionic2流媒体不起作用

[英]ionic2 Streaming Media is not working

I'm using the streaming media plugin in my ionic2 application. 我在ionic2应用程序中使用了流媒体插件。 this is my code: 这是我的代码:

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);

the errorCallback return " Class not found " errorCallback返回“ 找不到类

Any help for explain the reason of this log 任何有助于解释此日志原因的帮助

Thanks. 谢谢。

try below code : 试试下面的代码:

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);
      }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM