Youtube video unavailable on ios App

Hello everybody,
I hope you could help me.

I have created an app with ionic-v4 that uses iframe for showing some videos from youtube.

Every video works for android, while in ios every video but 3 are played correctly.

The iframe loads correctly the preview of the video, but when I click on play, it says video unavailable. Just three videos on 25.

We have tried to remove those 3 videos from youtube and the to resubmit them on the tube, yesterday night it worked, now they don’t work again.

What can be happened? Something about permissions or similar?

These are the videos that are not playing in ios

https://www.youtube.com/watch?v=5SRvoELJDw8
https://www.youtube.com/watch?v=Fj2KWJevFSI
https://www.youtube.com/watch?v=xxuv_zp5Fhs

and this is an example of video that is played correctly in ios

https://www.youtube.com/watch?v=ieL7Bzcu9Ow

And this is the code I use:

html:

(item.linkYoutube is the id of the youtube video, i.g. 5SRvoELJDw8 for the first video i posted)

    <iframe width="100%" height="250" [src]="getLinkYouTubeEmbedded(item.linkYoutube) | safe" frameborder="0" allowfullscreen>
    </iframe>

ts:

getLinkYouTubeEmbedded(x: string): string { return 'https://www.youtube.com/embed/' + x; }

pipe safe:

import { Pipe, PipeTransform } from ‘@angular/core’;
import { DomSanitizer } from ‘@angular/platform-browser’;

@Pipe({
name: ‘safe’
})
export class SafePipe implements PipeTransform {

constructor(private sanitizer: DomSanitizer) { }
transform(url) {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}

}

Thank you in advance.

1 Like