commencement de la page watching

This commit is contained in:
MiharyR 2021-11-21 01:30:53 +01:00
parent fd7322a7bc
commit ccb33d8aeb
27 changed files with 691 additions and 59 deletions

View file

@ -1,6 +1,20 @@
<div [class]="themeService.getClassTheme()">
<div class="myContainer">
<span class="helper"></span>
<img [src]="'assets/pub/'+ad.images[idxImage].url" [alt]="ad.images[idxImage].url">
</div>
<div *ngIf="from==='search' || from==='myPlaylists'" class="myContainer">
<span class="helper"></span>
<img [src]="'assets/pub/'+ad.images[idxImage].url"
[alt]="ad.images[idxImage].url"
id="imgFromSearchOrMyPlaylists">
</div>
<!-- --------------------------------------------------------------------- -->
<img *ngIf="from === 'watchingLeft'"
[src]="'assets/pub/'+ad.images[idxImage].url"
[alt]="ad.images[idxImage].url"
id="imgFromWatchingLeft">
<!-- --------------------------------------------------------------------- -->
<img *ngIf="from === 'watchingRight'"
[src]="'assets/pub/'+ad.images[idxImage].url"
[alt]="ad.images[idxImage].url"
id="imgFromWatchingRight">

View file

@ -6,23 +6,33 @@
transform: translateY(-50%);
}
img {
#imgFromSearchOrMyPlaylists {
max-width: 100%;
max-height: 100%;
border: solid 3px;
border: solid 3px black;
vertical-align: middle;
}
.lightTheme img {
border-color: black;
}
.darkTheme img {
border-color: white;
}
.helper {
display: inline-block;
height: 100%;
vertical-align: middle;
}
// ------------------------------------------------------------------------------
#imgFromWatchingLeft {
width: 14vw;
height: 70vh;
border: solid 3px black;
position: fixed;
left: 1vw;
}
#imgFromWatchingRight {
width: 15vw;
height: 70vh;
border: solid 3px black;
position: fixed;
right: 1vw;
}

View file

@ -12,6 +12,7 @@ import {ThemeService} from "../../../../utils/services/theme/theme.service";
export class AdvertComponent implements OnInit
{
@Input() ad: Advert;
@Input() from: string = "search";
idxImage: number = 0;
@ -22,6 +23,8 @@ export class AdvertComponent implements OnInit
{
const nbImages = this.ad.images.length;
this.idxImage = Math.floor(Math.random() * nbImages);
}
}

View file

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import {MessageService} from "../../../../utils/services/message/message.service";
import {MatDialog} from "@angular/material/dialog";
import {PopupAddVideoToPlaylistsComponent} from "../../components/popup-add-video-to-playlists/popup-add-video-to-playlists.component";
import {VideoDB} from "../../../../utils/interfaces/video";
import {VideoAll, VideoDB} from "../../../../utils/interfaces/video";
import {MatSnackBar} from "@angular/material/snack-bar";
import {FictitiousVideosService} from "../../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
@ -13,7 +13,7 @@ import {FictitiousVideosService} from "../../../../utils/services/fictitiousData
})
export class AddVideoToPlaylistsService
{
private _video: VideoDB;
private _video: VideoDB | VideoAll;
constructor( private messageService: MessageService,
@ -23,12 +23,12 @@ export class AddVideoToPlaylistsService
// --- FAUX CODE ---
run(video0: VideoDB): void
run(video0: VideoDB | VideoAll): void
{
this._video = video0;
const retour = {
status: "success",
data: this.fictitiousVideosService.getTabPlaylistDB(4, 5),
data: this.fictitiousVideosService.getRandomTabPlaylistDB(4, 5),
}
this.afterReceivingPlaylists(retour)
}

View file

@ -10,6 +10,15 @@ export class VideoUrlService
constructor(private _sanitizer: DomSanitizer) { }
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;
return this._sanitizer.bypassSecurityTrustResourceUrl(videoUrl);
}
/*
safeUrl(videoUrl: string): SafeResourceUrl
{
if(videoUrl.includes("youtu")) videoUrl = this.youtubeSafeUrl(videoUrl);
@ -42,4 +51,6 @@ export class VideoUrlService
const n = "https://www.dailymotion.com/".length;
return videoUrl.slice(0, n) + "embed/" + videoUrl.slice(n);
}
*/
}