avancement dans la connexion du back avec la partie user
This commit is contained in:
parent
7030a0ea21
commit
7444715b2f
11 changed files with 121 additions and 168 deletions
|
|
@ -96,7 +96,7 @@ export class PageHistoryUserComponent implements AfterViewInit
|
|||
onVideo(video: VideoAll): void
|
||||
{
|
||||
this.messageService
|
||||
.put("video/update/"+video._id, { watchedDate: true})
|
||||
.put("video/update/"+video._id, {watchedDate: true})
|
||||
.subscribe(ret => this.onVideoCallback(ret), err => this.onVideoCallback(err));
|
||||
|
||||
const url = '/user/watching/fromHistory/'+video.videoId+'/'+video.source ;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@
|
|||
<!-- pub -->
|
||||
<mat-grid-tile colspan="2" rowspan="1" class="cellulePub">
|
||||
<div class="conteneurPub">
|
||||
<!--
|
||||
<app-advert [ad]="ad"></app-advert>
|
||||
-->
|
||||
</div>
|
||||
</mat-grid-tile>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {ThemeService} from "../../../utils/services/theme/theme.service";
|
|||
import {Advert} from "../../../utils/interfaces/advert";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {PlaylistDB} from "../../../utils/interfaces/playlist";
|
||||
import {FictitiousAdvertsService} from "../../../utils/services/fictitiousDatas/fictitiousAdverts/fictitious-adverts.service";
|
||||
import {HttpParams} from "@angular/common/http";
|
||||
|
||||
|
||||
|
||||
|
|
@ -14,36 +14,36 @@ import {FictitiousAdvertsService} from "../../../utils/services/fictitiousDatas/
|
|||
})
|
||||
export class PageMyPlaylistsComponent implements OnInit
|
||||
{
|
||||
ad: Advert; // pub
|
||||
playlist: PlaylistDB; // la playlist sélectionnée
|
||||
ad: Advert; // pub
|
||||
playlist: any; // la playlist sélectionnée
|
||||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
private messageService: MessageService,
|
||||
private fictitiousAdvertsService: FictitiousAdvertsService ) { }
|
||||
private messageService: MessageService ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
this.ad = this.fictitiousAdvertsService.getAdvert();
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
let params = new HttpParams();
|
||||
params = params.append("quantity", 1);
|
||||
this.messageService
|
||||
.sendMessage("user/get/playlists", null)
|
||||
.subscribe( retour => {
|
||||
|
||||
if(retour.status === "error") console.log(retour.data);
|
||||
else {
|
||||
this.tabPlaylists = retour.data.playlists;
|
||||
this.ad = retour.data.ad;
|
||||
}
|
||||
})
|
||||
*/
|
||||
.get("user/ad", params)
|
||||
.subscribe(ret => this.adCallback(ret), err => this.adCallback(err));
|
||||
}
|
||||
|
||||
transmitToVideoList(playlist: PlaylistDB): void
|
||||
|
||||
adCallback(retour: any): void
|
||||
{
|
||||
if(retour !== "success") {
|
||||
console.log(retour);
|
||||
}
|
||||
else {
|
||||
this.ad = retour.data[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
transmitToVideoList(playlist): void
|
||||
{
|
||||
this.playlist = playlist;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
|
||||
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {VideoAll, VideoDB} from "../../../utils/interfaces/video";
|
||||
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||
|
|
@ -6,9 +6,10 @@ import {MessageService} from "../../../utils/services/message/message.service";
|
|||
import {PlaylistDB} from "../../../utils/interfaces/playlist";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
|
||||
import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fictitiousUtils/fictitious-utils.service";
|
||||
import {FictitiousVideosService} from "../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
|
||||
import {Router} from "@angular/router";
|
||||
import {HttpParams} from "@angular/common/http";
|
||||
import {ProfilService} from "../../../utils/services/profil/profil.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -17,24 +18,58 @@ import {Router} from "@angular/router";
|
|||
templateUrl: './video-list.component.html',
|
||||
styleUrls: ['./video-list.component.scss']
|
||||
})
|
||||
export class VideoListComponent implements OnChanges
|
||||
export class VideoListComponent implements OnChanges, OnInit
|
||||
{
|
||||
@Input() playlist: PlaylistDB;
|
||||
@Input() playlist: any;
|
||||
videosInPlaylist: VideoAll[] = [];
|
||||
allUserVideos: VideoAll[] = this.fictitiousVideosService.get_TAB_VIDEO();
|
||||
|
||||
|
||||
constructor( private messageService: MessageService,
|
||||
public themeService: ThemeService,
|
||||
private fictitiousUtilsService: FictitiousUtilsService,
|
||||
private addVideoToPlaylistService: AddVideoToPlaylistsService,
|
||||
private snackBar: MatSnackBar,
|
||||
public fictitiousVideosService: FictitiousVideosService,
|
||||
private historiqueService: UserHistoryService,
|
||||
private profilService: ProfilService,
|
||||
private router: Router ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
let params = new HttpParams();
|
||||
params = params.append("userId", this.profilService.id);
|
||||
console.log("id: " + this.profilService.id);
|
||||
this.messageService
|
||||
.get("video/findAll", params)
|
||||
.subscribe(ret => this.afterReceivingUserVideo(ret), err => this.afterReceivingUserVideo(err));
|
||||
}
|
||||
|
||||
|
||||
afterReceivingUserVideo(retour: any)
|
||||
{
|
||||
console.log("afterReceivingUserVideo: ");
|
||||
console.log(retour);
|
||||
|
||||
if(retour.status !== "success") {
|
||||
//console.log(retour);
|
||||
}
|
||||
else {
|
||||
this.allUserVideos = retour.data;
|
||||
this.reloadVideoInPlaylist();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void
|
||||
{
|
||||
console.log("ngOnChanges:");
|
||||
console.log(this.playlist);
|
||||
this.reloadVideoInPlaylist();
|
||||
}
|
||||
|
||||
|
||||
reloadVideoInPlaylist(): void
|
||||
{
|
||||
if((this.playlist !== null) && (this.playlist !== undefined))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
<!-- addButton -->
|
||||
<mat-grid-tile [colspan]="2" [rowspan]="2" class="mat-grid-tile-info-video">
|
||||
<button mat-icon-button (click)="onAdd(tabVideo[indexPage+k])">
|
||||
<button mat-icon-button (click)="onAddToPlaylist(tabVideo[indexPage+k])">
|
||||
<mat-icon>add_circle</mat-icon>
|
||||
</button>
|
||||
</mat-grid-tile>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import {Component, Input, OnChanges } from '@angular/core';
|
||||
import {Component, Input } from '@angular/core';
|
||||
import {VideoAll} from "../../../utils/interfaces/video";
|
||||
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
|
||||
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||
import {Router} from "@angular/router";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -11,26 +12,24 @@ import {Router} from "@angular/router";
|
|||
templateUrl: './video-grid.component.html',
|
||||
styleUrls: ['./video-grid.component.scss']
|
||||
})
|
||||
export class VideoGridComponent implements OnChanges
|
||||
export class VideoGridComponent
|
||||
{
|
||||
@Input() tabVideo: VideoAll[] = [];
|
||||
@Input() search: string = '';
|
||||
indexPage: number = 0;
|
||||
|
||||
|
||||
constructor( private historiqueService: UserHistoryService,
|
||||
private addVideoToPlaylistsService: AddVideoToPlaylistsService,
|
||||
private router: Router) {}
|
||||
private router: Router,
|
||||
private messageService: MessageService ) {}
|
||||
|
||||
|
||||
ngOnChanges(): void
|
||||
onAddToPlaylist(video: VideoAll): void
|
||||
{
|
||||
//this.historiqueService.clearTabVideoUrlClicked();
|
||||
this.addVideoToPlaylistsService.run(video.videoId, video.source, video.interest);
|
||||
}
|
||||
|
||||
onAdd(video: VideoAll): void
|
||||
{
|
||||
this.addVideoToPlaylistsService.run(video.videoId, video.source);
|
||||
}
|
||||
|
||||
tronquage(str: string)
|
||||
{
|
||||
|
|
@ -38,10 +37,22 @@ export class VideoGridComponent implements OnChanges
|
|||
else return str.substring(0, 30) + "..." ;
|
||||
}
|
||||
|
||||
|
||||
onVideo(video: VideoAll): void
|
||||
{
|
||||
const data = { source: video.source, interest: video.interest };
|
||||
this.messageService
|
||||
.post("video/create/"+video.videoId, data)
|
||||
.subscribe(ret => this.onVideoCallback(ret), err => this.onVideoCallback(err));
|
||||
|
||||
const url = '/user/watching/fromSearch/'+video.videoId+'/'+video.source+'/'+this.search;
|
||||
this.router.navigateByUrl(url);
|
||||
}
|
||||
|
||||
|
||||
onVideoCallback(retour: any): void
|
||||
{
|
||||
if(retour.status !== "success") console.log(retour);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,5 +37,5 @@
|
|||
|
||||
<mat-dialog-actions style="justify-content: flex-end;">
|
||||
<button mat-button mat-dialog-close (click)="onAnnuler()">Annuler</button>
|
||||
<button mat-button [mat-dialog-close]="true" cdkFocusInitial (click)="onValider()">Valider</button>
|
||||
<button mat-button mat-dialog-close="success" cdkFocusInitial (click)="onValider()">Valider</button>
|
||||
</mat-dialog-actions>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {VideoDB} from "../../../../utils/interfaces/video";
|
||||
import {MessageService} from "../../../../utils/services/message/message.service";
|
||||
|
||||
|
||||
|
|
@ -22,10 +21,6 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
|||
goToCreatePlaylist = false;
|
||||
newPlaylistName = "";
|
||||
|
||||
isFinishedForExistingPlaylist: boolean = false;
|
||||
isFinishedForNewPlaylist: boolean = false;
|
||||
|
||||
|
||||
|
||||
constructor( public dialogRef: MatDialogRef<PopupAddVideoToPlaylistsComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data,
|
||||
|
|
@ -39,12 +34,10 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
|||
this.source = this.data.source;
|
||||
this.interest = this.data.interest;
|
||||
|
||||
console.log("---");
|
||||
console.log(this.data._idVideo);
|
||||
console.log(this.data.videoId);
|
||||
console.log(this.data.source);
|
||||
console.log(this.data.interest);
|
||||
console.log("---");
|
||||
console.log("_id: " + this._idVideo);
|
||||
console.log("videoId: " + this.videoId);
|
||||
console.log("source: " + this.source);
|
||||
console.log("interest: " + this.interest);
|
||||
|
||||
for(let playlist of this.data.playlists)
|
||||
{
|
||||
|
|
@ -58,20 +51,24 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
|||
onValider(): void
|
||||
{
|
||||
// --- Existing playlists ---
|
||||
|
||||
let listeDesPlaylists = "" ;
|
||||
for(let playlist of this.tabPlaylistAndBool) listeDesPlaylists += playlist.id + ","
|
||||
for(let playlist of this.tabPlaylistAndBool)
|
||||
{
|
||||
if(playlist.isSelected) listeDesPlaylists += playlist.id + "," ;
|
||||
}
|
||||
if(listeDesPlaylists.endsWith(",")) listeDesPlaylists = listeDesPlaylists.slice(0, listeDesPlaylists.length-1);
|
||||
|
||||
console.log(listeDesPlaylists);
|
||||
const data1 = { videoId: this._idVideo }
|
||||
this.messageService
|
||||
.put( "playlist/update/"+ listeDesPlaylists, data1)
|
||||
.subscribe( ret => this.callbackForExistingPlaylists(ret), err => this.callbackForExistingPlaylists(err));
|
||||
if(listeDesPlaylists !== "")
|
||||
{
|
||||
const data1 = { videoId: this._idVideo };
|
||||
this.messageService
|
||||
.put( "playlist/update/"+listeDesPlaylists, data1)
|
||||
.subscribe( ret => this.callbackForExistingPlaylists(ret), err => this.callbackForExistingPlaylists(err));
|
||||
}
|
||||
|
||||
|
||||
// --- New playlists ---
|
||||
|
||||
if(this.goToCreatePlaylist)
|
||||
{
|
||||
const data2 = {
|
||||
|
|
@ -82,14 +79,6 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
|||
.post("playlist/create", data2)
|
||||
.subscribe( ret => this.callbackForNewPlaylist(ret), err => this.callbackForNewPlaylist(err));
|
||||
}
|
||||
else {
|
||||
this.isFinishedForNewPlaylist = true;
|
||||
}
|
||||
|
||||
|
||||
// Attente active
|
||||
while((!this.isFinishedForExistingPlaylist) || (!this.isFinishedForNewPlaylist)) {}
|
||||
this.dialogRef.close("success");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -97,16 +86,12 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
|||
callbackForExistingPlaylists(retour: any): void
|
||||
{
|
||||
console.log("onValiderCallback");
|
||||
//console.log(retour);
|
||||
console.log(retour);
|
||||
|
||||
if(retour.status !== "success") {
|
||||
console.log(retour);
|
||||
//console.log(retour);
|
||||
this.dialogRef.close(null);
|
||||
}
|
||||
else {
|
||||
this.isFinishedForExistingPlaylist = true;
|
||||
console.log("isFinishedForExistingPlaylist: true");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -114,15 +99,12 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
|||
callbackForNewPlaylist(retour: any): void
|
||||
{
|
||||
console.log("callbackForNewPlaylist");
|
||||
console.log(retour);
|
||||
|
||||
if(retour.status !== "success") {
|
||||
//console.log(retour);
|
||||
console.log(retour);
|
||||
this.dialogRef.close(null);
|
||||
}
|
||||
else {
|
||||
this.isFinishedForNewPlaylist = true;
|
||||
console.log("isFinishedForNewPlaylist: true");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -132,49 +114,4 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
|||
this.dialogRef.close("annulation");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
//nbPlaylistSelected: number = 0;
|
||||
//numPlaylistSelected: number = 0;
|
||||
|
||||
onValider(): void
|
||||
{
|
||||
for(let playlist of this.tabPlaylistAndBool)
|
||||
{
|
||||
if(playlist.isSelected) this.nbPlaylistSelected += 1;
|
||||
}
|
||||
|
||||
for(let playlist of this.tabPlaylistAndBool)
|
||||
{
|
||||
if(playlist.isSelected)
|
||||
{
|
||||
playlist.videoIds.push(this._idVideo);
|
||||
this.messageService
|
||||
.put("playlist/update/"+playlist._id, playlist.videoIds)
|
||||
.subscribe(ret => this.onAddingToExistingPlaylist(ret), err => this.onAddingToExistingPlaylist(err));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onAddingToExistingPlaylist(retour: any): void
|
||||
{
|
||||
console.log("onValiderCallback");
|
||||
console.log(retour);
|
||||
this.numPlaylistSelected += 1;
|
||||
|
||||
if(retour.status !== "success") {
|
||||
this.dialogRef.close("annulation");
|
||||
}
|
||||
else {
|
||||
if(this.numPlaylistSelected === this.numPlaylistSelected)
|
||||
{
|
||||
this.dialogRef.close("success");
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,49 +19,25 @@ export class AddVideoToPlaylistsService
|
|||
private interest: string = "" ;
|
||||
|
||||
|
||||
|
||||
constructor( private messageService: MessageService,
|
||||
public dialog: MatDialog,
|
||||
private fictitiousVideosService: FictitiousVideosService,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
||||
|
||||
|
||||
run(videoId: string, source: string): void
|
||||
run(videoId: string, source: string, interest: string): void
|
||||
{
|
||||
this.videoId = videoId;
|
||||
this.source = source;
|
||||
this.interest = interest;
|
||||
|
||||
let params = new HttpParams();
|
||||
if(source === "Youtube") params = params.append("source", "yt");
|
||||
else params = params.append("source", "dm");
|
||||
const data = { source: this.source, interest: this.interest };
|
||||
this.messageService
|
||||
.get("video/get/"+videoId, params)
|
||||
.subscribe(ret => this.afterAskingVideoInfo(ret), err => this.afterAskingVideoInfo(err));
|
||||
.post("video/create/"+this.videoId, data)
|
||||
.subscribe(ret => this.afterCreatingVideo(ret), err => this.afterCreatingVideo(err));
|
||||
}
|
||||
|
||||
|
||||
|
||||
afterAskingVideoInfo(retour: any): void
|
||||
{
|
||||
console.log("afterAskingVideoInfo");
|
||||
console.log(retour);
|
||||
|
||||
if(retour.status !== "success") {
|
||||
//console.log(retour);
|
||||
}
|
||||
else {
|
||||
this.interest = retour.data.interest;
|
||||
const data = { source: this.source, interest: this.interest };
|
||||
this.messageService
|
||||
.post("video/create/"+this.videoId, data)
|
||||
.subscribe(ret => this.afterCreatingVideo(ret), err => this.afterCreatingVideo(err));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private afterCreatingVideo(retour: any): void
|
||||
{
|
||||
console.log("afterCreatingVideo");
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@
|
|||
|
||||
<!-- btnAdd -->
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<button mat-button style="border: solid 1px black" (click)="onAdd()">
|
||||
<button mat-button style="border: solid 1px black" (click)="onAddToPlaylist()">
|
||||
Ajouter à une playlist <mat-icon>add_circle</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ export class PageWatchingVideoComponent implements OnInit
|
|||
{
|
||||
tabPlateform = TAB_PLATEFORM;
|
||||
video = {
|
||||
title: "zzz",
|
||||
title: "",
|
||||
videoId: "",
|
||||
views: 0,
|
||||
publishedAt: null,
|
||||
description: "",
|
||||
|
|
@ -41,7 +42,7 @@ export class PageWatchingVideoComponent implements OnInit
|
|||
from: string = "";
|
||||
|
||||
playlist: PlaylistDB;
|
||||
videosInPlaylist: VideoAll[] = [];
|
||||
videosInPlaylist: any[] = [];
|
||||
|
||||
hiddenDescription: boolean = true;
|
||||
iframeStyle: string = "";
|
||||
|
|
@ -54,19 +55,12 @@ export class PageWatchingVideoComponent implements OnInit
|
|||
public themeService: ThemeService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private _sanitizer: DomSanitizer,
|
||||
private addVideoToPlaylistsService: AddVideoToPlaylistsService ) { }
|
||||
private _sanitizer: DomSanitizer ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
//const videoId = this.activatedRoute.snapshot.paramMap.get('videoId');
|
||||
//this.video = this.fictitiousVideosService.getVideoByVideoId(videoId);
|
||||
//this.ad1 = this.fictitiousAdvertsService.getAdvert();
|
||||
//this.ad2 = this.fictitiousAdvertsService.getAdvert();
|
||||
|
||||
// findVideoCallback
|
||||
// Ask for videos
|
||||
const videoId = this.activatedRoute.snapshot.paramMap.get('videoId');
|
||||
let params1 = new HttpParams();
|
||||
let source = "" ;
|
||||
|
|
@ -77,7 +71,7 @@ export class PageWatchingVideoComponent implements OnInit
|
|||
.get("video/get/"+videoId, params1)
|
||||
.subscribe(ret => this.findVideoCallback(ret), err => this.findVideoCallback(err));
|
||||
|
||||
// advert
|
||||
// Ask for adverts
|
||||
let params2 = new HttpParams();
|
||||
params2 = params2.append("quantity", 2);
|
||||
this.messageService
|
||||
|
|
@ -101,6 +95,7 @@ export class PageWatchingVideoComponent implements OnInit
|
|||
}
|
||||
}
|
||||
|
||||
// style
|
||||
if(this.from === 'search' || this.from === 'history')
|
||||
{
|
||||
this.containerStyle = "margin: 0 auto; width: 64vw;"
|
||||
|
|
@ -110,9 +105,6 @@ export class PageWatchingVideoComponent implements OnInit
|
|||
this.containerStyle = "margin: 0 auto; width: 48vw;"
|
||||
this.iframeStyle = "width: 48vw; height: 45vh;" ;
|
||||
}
|
||||
|
||||
// --- VRAI CODE ---
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -145,7 +137,7 @@ export class PageWatchingVideoComponent implements OnInit
|
|||
}
|
||||
|
||||
|
||||
onAdd(): void
|
||||
onAddToPlaylist(): void
|
||||
{
|
||||
//this.addVideoToPlaylistsService.run(this.video);
|
||||
}
|
||||
|
|
@ -162,8 +154,8 @@ export class PageWatchingVideoComponent implements OnInit
|
|||
safeUrl(videoId: string, source: string): SafeResourceUrl
|
||||
{
|
||||
let videoUrl = "" ;
|
||||
if(source === 'Youtube') videoUrl = "https://www.youtube.com/embed/" + videoId;
|
||||
else if(source === 'Dailymotion') videoUrl = "https://www.dailymotion.com/embed/video/" + videoId;
|
||||
if(source === 'Youtube') videoUrl = "https://www.youtube.com/embed/" + videoId + "?autoplay=1";
|
||||
else if(source === 'Dailymotion') videoUrl = "https://www.dailymotion.com/embed/video/" + videoId + "?autoplay=true";
|
||||
return this._sanitizer.bypassSecurityTrustResourceUrl(videoUrl);
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue