diff --git a/src/app/player/player.component.css b/src/app/player/player.component.css
index 74acd16..cc5a298 100644
--- a/src/app/player/player.component.css
+++ b/src/app/player/player.component.css
@@ -44,7 +44,18 @@
bottom: 25px;
}
+.favorite-button {
+ left: 25px;
+ position: absolute;
+ bottom: 25px;
+}
+
.video-col {
padding-right: 0px;
padding-left: 0.01px;
+}
+
+.save-icon {
+ bottom: 1px;
+ position: relative;
}
\ No newline at end of file
diff --git a/src/app/player/player.component.html b/src/app/player/player.component.html
index 66f4201..f3a3e7e 100644
--- a/src/app/player/player.component.html
+++ b/src/app/player/player.component.html
@@ -16,9 +16,10 @@
1">
-
+
+
-
+
\ No newline at end of file
diff --git a/src/app/player/player.component.ts b/src/app/player/player.component.ts
index e42ba74..eebd514 100644
--- a/src/app/player/player.component.ts
+++ b/src/app/player/player.component.ts
@@ -1,7 +1,9 @@
-import { Component, OnInit, HostListener } from '@angular/core';
+import { Component, OnInit, HostListener, EventEmitter } from '@angular/core';
import { VgAPI } from 'videogular2/compiled/core';
import { PostsService } from 'app/posts.services';
-import { ActivatedRoute } from '@angular/router';
+import { ActivatedRoute, Router } from '@angular/router';
+import { MatDialog, MatSnackBar } from '@angular/material';
+import { InputDialogComponent } from 'app/input-dialog/input-dialog.component';
export interface IMedia {
title: string;
@@ -33,6 +35,8 @@ export class PlayerComponent implements OnInit {
downloading = false;
+ id = null;
+
@HostListener('window:resize', ['$event'])
onResize(event) {
this.innerWidth = window.innerWidth;
@@ -43,6 +47,7 @@ export class PlayerComponent implements OnInit {
this.fileNames = this.route.snapshot.paramMap.get('fileNames').split('|nvr|');
this.type = this.route.snapshot.paramMap.get('type');
+ this.id = this.route.snapshot.paramMap.get('id');
// loading config
this.postsService.loadNavItems().subscribe(result => { // loads settings
@@ -83,7 +88,8 @@ export class PlayerComponent implements OnInit {
}
- constructor(private postsService: PostsService, private route: ActivatedRoute) {
+ constructor(private postsService: PostsService, private route: ActivatedRoute, private dialog: MatDialog, private router: Router,
+ public snackBar: MatSnackBar) {
}
@@ -157,4 +163,57 @@ export class PlayerComponent implements OnInit {
});
}
+ namePlaylistDialog() {
+ const done = new EventEmitter();
+ const dialogRef = this.dialog.open(InputDialogComponent, {
+ width: '300px',
+ data: {
+ inputTitle: 'Name the playlist',
+ inputPlaceholder: 'Name',
+ submitText: 'Favorite',
+ doneEmitter: done
+ }
+ });
+
+ done.subscribe(name => {
+
+ // Eventually do additional checks on name
+ if (name) {
+ this.postsService.createPlaylist(name, this.fileNames, this.type, null).subscribe(res => {
+ if (res['success']) {
+ dialogRef.close();
+ const new_playlist = res['new_playlist'];
+ this.openSnackBar('Playlist \'' + name + '\' successfully created!', '')
+ this.playlistPostCreationHandler(new_playlist.id);
+ }
+ });
+ }
+ });
+ }
+
+ /*
+ createPlaylist(name) {
+ this.postsService.createPlaylist(name, this.fileNames, this.type, null).subscribe(res => {
+ if (res['success']) {
+ console.log('Success!');
+ }
+ });
+ }
+ */
+
+ playlistPostCreationHandler(playlistID) {
+ // changes the route without moving from the current view or
+ // triggering a navigation event
+ this.id = playlistID;
+ console.log(this.router.url);
+ this.router.navigateByUrl(this.router.url + ';id=' + playlistID);
+ }
+
+ // snackbar helper
+ public openSnackBar(message: string, action: string) {
+ this.snackBar.open(message, action, {
+ duration: 2000,
+ });
+ }
+
}