Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.subscribe(result => {
if (result.items.length > 0) {
console.log(result);
const { videoId } = result.items[0].id;
this.movie.videoId = videoId;
// Code to use capacitor-youtube-player plugin.
console.log('DetailsPage::watchTrailer -> platform: ' + Capacitor.platform);
if (Capacitor.platform === 'web') {
const componentProps = { modalProps: { item: this.movie}};
this.presentModal(componentProps, YoutubeModalComponent);
} else { // Native
this.testYoutubePlayerPlugin();
}
/*
if (Capacitor.platform === 'web') {
window.open('https://www.youtube.com/watch?v=' + videoId);
} else { // TODO: Use capacitor-youtube-player plugin.
window.open('https://www.youtube.com/watch?v=' + videoId, '_blank');
}
*/
}
},
error => {
constructor(private toastController: ToastController, private loadingCtrl: LoadingController) {
console.log('NetworkService::constructor | method called');
let status = ConnectionStatus.Offline;
if (Capacitor.platform === 'web') {
console.log('WEB');
console.log('navigator.onLine', navigator.onLine);
this.addConnectivityListenersBrowser();
status = navigator.onLine === true ? ConnectionStatus.Online : ConnectionStatus.Offline;
} else { // Native: use capacitor network plugin
console.log('NATIVE');
this.addConnectivityListernerNative();
// status = Network.getStatus();
}
this.status.next(status);
}
.subscribe(result => {
if (result.items.length > 0) {
console.log(result);
const { videoId } = result.items[0].id;
this.movie.videoId = videoId;
// Code to use capacitor-youtube-player plugin.
console.log('DetailsPage::watchTrailer -> platform: ' + Capacitor.platform);
if (Capacitor.platform === 'web') {
const componentProps = { modalProps: { item: this.movie}};
this.presentModal(componentProps, YoutubeModalComponent);
} else { // Native
this.testYoutubePlayerPlugin();
}
/*
if (Capacitor.platform === 'web') {
window.open('https://www.youtube.com/watch?v=' + videoId);
} else { // TODO: Use capacitor-youtube-player plugin.
window.open('https://www.youtube.com/watch?v=' + videoId, '_blank');
}
*/
}
},
isIOS() {
return Capacitor.platform === 'ios'
},
}
isWeb() {
return Capacitor.platform === 'web'
},