Home » Android » android – Streaming media Error: Unknown (1) -2147483648 ionic 3-Exceptionshub

android – Streaming media Error: Unknown (1) -2147483648 ionic 3-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment

Questions:

I’m trying to display a dailymotion video inside a ionic 3 app.

I’ve add the plugin in accord to the documentation ionic, then i’ve add to the providers in my app.module.ts
Then in the component that will use the plugin I add it in my constructor add declare the following function :

export class DailyMotionVideoComponent{

  @Input() videoId: any;
  baseURL: string = 'https://www.dailymotion.com/embed/video/';

  constructor(private sanitizer: DomSanitizer, private streamingMedia : StreamingMedia) { }

  public playStream(){
    var url = `${this.baseURL}${this.videoId}`;
    console.log("url : "+url)

      let options: StreamingVideoOptions = {
      successCallback: () => { console.log('Video played') },
      errorCallback: (e) => { console.log('Error streaming : ' + e) },
      orientation: 'landscape',
      shouldAutoClose: true,
      controls: false
      };

    this.streamingMedia.playVideo(url, options);
  }
}

When i run it on a physical android device the video never play and in my console I obtain the following log :

Error streaming : MediaPlayer Error: Unknown (1) -2147483648

I’ve already add in the file config.xml inside the android platform statement

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
        <application android:usesCleartextTraffic="true" />
</edit-config>

And declare this authorisation in the file index.html

  <meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline'; media-src *; connect-src *">

When I log the url of my video it gives me a reachable url that I can retrieve inside an iFrame, so the problem isn’t coming from this.

How to&Answers: