Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

Angular youTube-player not working on IOS

$
0
0

I did try to use the angular youTube player library in ionic 5. It did work like expected on Android, but do not show on ios.

Does somebody had the same problem and know how to fix it?

This is my code

// component.html
<youtube-player videoId="82iWIKejaiQ" width="260px" height="260px"></youtube-player>
// module.ts
import { YouTubePlayerModule } from '@angular/youtube-player'

imports [
    CommonModule,
    IonicModule,
    YouTubePlayerModule,
]
// component.ts

export class YouTubeComponent implements OnInit {
  ngOnInit(): void {
    loadScript('https://www.youtube.com/iframe_api')
  }
}
// utilities.ts 
export const loadScript = (target: string): void => {
  if (!isScriptLoaded(target)) {
    const tag = document.createElement('script')
    tag.src = target
    document.body.appendChild(tag)
  }
}

const isScriptLoaded = (target: string): boolean => {
  return document.querySelector('script[src="' + target + '"]') ? true : false
}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>