0

I'm trying to bind a url in video from API, but I'm taking this error below, I tried DomSanitizer and others but dosent work.

Error Failed to load resource: net::ERR_FILE_NOT_FOUND

My last try

 load() {
        this.liveProvider.load().then((data) => {
          this.urlStrean = "http://evcv.mm.uol.com.br:1935/band/terraviva/playlist.m3u8";//this.getSafeUrl(data.result.url);
          this.getSafeUrl(this.urlStrean);
          console.log(this.urlStrean);
        }).catch((error) => {
          console.log(error);
        })
      }




   getSafeUrl(url) {
        return this.sanitizer.bypassSecurityTrustUrl(url);
      }

and in my view:

 <video width="100%" controls autoplay>
     <source [src]="urlStrean" type="application/x-mpegURL">
  </video>
thiago.adriano26
  • 1,491
  • 3
  • 14
  • 19

1 Answers1

0

I solved problem with this code below:

constructor(public navCtrl: NavController, private liveProvider: LiveProvider, public sanitizer: DomSanitizer) {
    this.liveProvider.load().then((data) => {
      this.obj = sanitizer.bypassSecurityTrustResourceUrl(data.result.url);
      // this.obj = sanitizer.bypassSecurityTrustResourceUrl("http://evcv.mm.uol.com.br:1935/band/terraviva/playlist.m3u8");
      this.trustedUrl = this.obj;
    }).catch((error) => {
      console.log(error);
    })
thiago.adriano26
  • 1,491
  • 3
  • 14
  • 19