image video à la place de iframe

This commit is contained in:
MiharyR 2021-11-19 15:42:51 +01:00
parent 500b32626e
commit b045f507d2
92 changed files with 945 additions and 656 deletions

View file

@ -18,10 +18,13 @@
<ng-container matColumnDef="aperçu">
<th mat-header-cell *matHeaderCellDef> Aperçu </th>
<td mat-cell *matCellDef="let video">
<img [src]="video.imageUrl" width="200px" height="100px">
<!--
<iframe appIframeTracker
[src]=videoUrlService.safeUrl(video.url)
[src]=videoUrlService.safeUrl(video.videoId)
(iframeClick)="onIframeClick(video)"
allowfullscreen></iframe>
-->
</td>
</ng-container>
@ -35,9 +38,7 @@
<ng-container matColumnDef="date">
<th mat-header-cell *matHeaderCellDef> Date </th>
<td mat-cell *matCellDef="let video">
<li *ngFor="let date0 of video.watched">
{{date0 | date:'dd/LL/YYYY à HH:mm:ss'}}
</li>
{{video.watchedDates[video.watchedDates.length-1] | date:'dd/LL/YYYY à HH:mm:ss'}}
</td>
</ng-container>

View file

@ -9,27 +9,11 @@ table {
margin: 0 auto;
}
/*
mat-paginator {
width: 30%;
text-align: center;
}
*/
th.mat-sort-header-sorted {
color: black;
}
/*
.lightTheme td {
padding: 10px 30px 5px 5px;
}
.darkTheme td {
background-color: #646464;
color: white;
padding: 10px 30px 5px 5px;
}
*/
input {
width: 35%;

View file

@ -1,13 +1,13 @@
import {AfterViewInit, Component, ViewChild} from '@angular/core';
import {ThemeService} from "../../../utils/services/theme/theme.service";
import {MessageService} from "../../../utils/services/message/message.service";
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
import {MatTableDataSource} from "@angular/material/table";
import {MatSort} from "@angular/material/sort";
import {VideoUrlService} from "../../../utils/services/videoUrl/video-url.service";
import {UserHistoryService} from "../../../utils/services/userHistory/userHistory.service";
import {Video} from "../../../utils/interfaces/video";
import {VideoUrlService} from "../../utils/services/videoUrl/video-url.service";
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
import {MatPaginator} from "@angular/material/paginator";
import {FictitiousVideosService} from "../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
import {VideoAll} from "../../../utils/interfaces/video";
@ -26,7 +26,7 @@ export class PageHistoryUserComponent implements AfterViewInit
constructor( public themeService: ThemeService,
private messageService: MessageService,
private fictitiousDatasService: FictitiousDatasService,
private fictitiousVideosService: FictitiousVideosService,
public videoUrlService: VideoUrlService,
private userHistoryService: UserHistoryService ) { }
@ -37,23 +37,8 @@ export class PageHistoryUserComponent implements AfterViewInit
this.userHistoryService.clearTabVideoUrlClicked();
// --- FAUX CODE ---
const tabVideo: Video[] = this.fictitiousDatasService.getTabVideo(8);
const tabVideoChanged = [];
for(let video of tabVideo)
{
tabVideoChanged.push({
_id: video._id,
url: video.url,
title: video.title,
description: video.description,
views: video.views,
watched: video.watched,
source: this.getSourceByUrl(video.url)
});
}
this.dataSource = new MatTableDataSource(tabVideoChanged);
const tabVideo: VideoAll[] = this.fictitiousVideosService.getTabVideoAll(8);
this.dataSource = new MatTableDataSource(tabVideo);
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.paginator;
this.dataSource = this.dataSource;
@ -92,7 +77,7 @@ export class PageHistoryUserComponent implements AfterViewInit
// Supprime la video
onDelete(video: Video): void
onDelete(video: VideoAll): void
{
// --- FAUX CODE ---
const index = this.dataSource.data.indexOf(video);
@ -118,11 +103,11 @@ export class PageHistoryUserComponent implements AfterViewInit
}
// Ajoute la date actuelle dans watched.video
onIframeClick(video: Video): void
// Ajoute la date actuelle dans watchedDates.video
onIframeClick(video: VideoAll): void
{
console.log("onIframeClick: " + video.title);
this.userHistoryService.addVideoToHistoque(video);
//this.userHistoryService.addVideoToHistoque(video);
}
}