Skip to content

Commit 3162d68

Browse files
authored
2.2 - Updating to latest version
2 parents 4041133 + 712adfe commit 3162d68

9 files changed

+106
-36
lines changed

README.md

+22-21
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</p>
88

99
# About Player
10-
[![Version](https://img.shields.io/badge/Current%20version-v2.1-brightgreen.svg?style=flat)](https://github.com/quead/angular2-yt-player)
10+
[![Version](https://img.shields.io/badge/Current%20version-v2.2-brightgreen.svg?style=flat)](https://github.com/quead/angular2-yt-player)
1111
[![Build Status](https://semaphoreci.com/api/v1/quead/angular2-yt-player/branches/master/badge.svg)](https://semaphoreci.com/quead/angular2-yt-player)
1212

1313
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/quead/angular2-yt-player/master/LICENSE)
@@ -79,26 +79,29 @@ or
7979
<a href="https://youtu.be/KB803dWQM-o/" title="Video Presentation">Video Presentation</a>
8080

8181
## Changelog
82-
Angular2 YT Player v2.1
82+
Angular YouTube Player 2.2
83+
- Sort playlist by drag and drop (used [ng2-dragula](https://valor-software.com/ng2-dragula/ "NG2 Dragula"))
84+
85+
Angular YT Player v2.1
8386
- Categories with videos like (music, gaming, autos, films, sports, etc.)
8487
- Refactoring code
8588
- Search on specific region
8689
- Fixing copy link for featured video
8790
- UX improvements
8891

89-
Angular2 YT Player v2.0.1
92+
Angular YouTube Player 2.0.1
9093
- Import & export youtube playlist as .JSON file
9194

92-
Angular2 YT Player v2.0
95+
Angular YouTube Player 2.0
9396
- Global hotkeys for application in desktop (play/pause/next/prev, for keyboards with media buttons)
9497
- Adding support for NW.js to export the app for desktop compatible: Windows x64, Linux x64
9598
- Auto updating the app (desktop version)
9699

97-
Angular2 YT Player v1.9.2
100+
Angular YouTube Player 1.9.2
98101
- UX improvements and fixes
99102
- Preparing files for 2.0
100103

101-
Angular2 YT Player v1.9.1
104+
Angular YouTube Player 1.9.1
102105
- Get settings.json for localstorage if your localstorage is empty
103106
- The playlist automatically saving, if is empty it will be populated with related videos
104107
- Toggle light/dark theme mode
@@ -108,31 +111,31 @@ Angular2 YT Player v1.9.1
108111
- Manual saving for external settings (check settings)
109112
- Performance, UI and UX improvements and fixes
110113

111-
Angular2 YT Player v1.9
114+
Angular YouTube Player 1.9
112115
- Add/remove items from playlist, first time when is initialized It is prepopulated with related videos
113116
- Next/prev video from your playlist
114117
- Moved history to separate page
115118
- Adding toggle video, repeat mode and list & grid on trending to settings.json
116119
- Small fixes
117120

118-
Angular2 YT Player v1.7
121+
Angular YouTube Player 1.7
119122
- Added featured video as first video from trending
120123
- Notifications for important actions you do
121124
- Removed debugging mode
122125
- Preparing packages, code and files for v2.0
123126
- Improved UI/UX for lists
124127

125-
Angular2 YT Player v1.6
128+
Angular YouTube Player 1.6
126129
- Video details for current video and trending videos like number of views, likes and dislikes
127130
- Share link for current video
128131
- Added new setting for hiding all thumbnails
129132
- Custom player buttons shows now only when you hide video
130133

131-
Angular2 YT Player v1.4
134+
Angular YouTube Player 1.4
132135
- History of your watched videos
133136
- Small fixes
134137

135-
Angular2 YT Player v1.3
138+
Angular YouTube Player 1.3
136139
- Show/hide video player
137140
- Repeat video
138141
- Grid/list mode for trending videos
@@ -142,15 +145,15 @@ Angular2 YT Player v1.3
142145
- *YOUR_API Key*
143146
- *Max related videos (0 to 50)*
144147

145-
Angular2 YT Player v1.2
148+
Angular YouTube Player 1.2
146149
- Introducing trending videos, currently default trending videos are from United States
147150
- Refactoring the code
148151
- Adding routes for future components which it will show in left navbar
149152
- Default video will be first from trending videos
150153
- Adding the video player
151154
- Update the design to match the new features
152155

153-
Angular2 YT Player v1.1
156+
Angular YouTube Player 1.1
154157
- Adding mute/unmute functionality
155158
- Improved user interface and user experience
156159
- Adding settings functionality, the settings will get from ***assets/settings.json***
@@ -159,11 +162,11 @@ Angular2 YT Player v1.1
159162
- *Show/hide thumbnails in search*
160163

161164

162-
Angular2 YT Player v1.0.2
165+
Angular YouTube Player 1.0.2
163166
- Change volume on your video
164167
- Related videos
165168

166-
Angular2 YT Player v1.0.0
169+
Angular YouTube Player 1.0.0
167170
- Search and play video from youtube
168171
- Play/pause video
169172
- Change time of your video that you want to listen
@@ -177,16 +180,14 @@ Angular2 YT Player v1.0.0
177180
- *Room chat **(unversioned)***
178181

179182
#### Roadmap to 3.0
180-
- Drag and drop videos to playlist **(in v2.2)**
181-
- Arrange playlist by drag and drop **(in v2.2)**
182183
- Integrating Google accounts **(in v2.4)**
183184
- Integrating firebase **(in v2.5)**
184185

185186
- **Rooms**
186-
- *Create room where you can watch videos with others in sync by sharing the room link **(in v3.0)***
187-
- *Set private/public room **(in v3.0)***
188-
- *List of public rooms **(in v3.0)***
189-
- *Room moderators which can add videos, kick roommates, mute roommates, rename room title and description **(in v3.3)***
187+
- *Create room where you can watch videos with others in sync by sharing the room link **(in v2.7)***
188+
- *Set private/public room **(in v2.7)***
189+
- *List of public rooms **(in v2.8)***
190+
- *Room moderators which can add videos, kick roommates, mute roommates, rename room title and description **(in v2.9)***
190191

191192
## Copyright and License
192193
Copyright [quead](https://github.com/quead) under the [MIT license](LICENSE).

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@types/youtube": "0.0.31",
2525
"child_process": "^1.0.2",
2626
"core-js": "^2.4.1",
27+
"ng2-dragula": "^1.5.0",
2728
"ngx-youtube-player": "0.0.41",
2829
"rxjs": "^5.5.6",
2930
"zone.js": "^0.8.19"

src/app/app.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h1><span class="favicon-app"></span>YouTube Player v2.0</h1>
4747
<button type="button" class="video-item-head-btn" (click)="clearPlaylist()"><span class="fa fa-close"></span>clear</button>
4848
<button type="button" class="video-item-head-btn" (click)="exportPlaylist()"><span class="fa fa-cog"></span>manage</button>
4949
</div>
50-
<div class="playlist-video-content" #playlistContainer>
50+
<div class="playlist-video-content" [dragula]='"playlistDrag"' [dragulaModel]='playlistVideos' #playlistContainer>
5151
<div *ngIf="playlistVideos.length === 0" class="video-list-info">
5252
Empty playlist
5353
</div>

src/app/app.component.ts

+48-10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { YoutubeGetVideo } from './shared/youtube.service';
33
import { SharedService } from './shared/lists.service';
44
import { NwjsService } from './shared/nwjs.service';
55
import { Event } from '@angular/router/src/events';
6+
import { DragulaService } from 'ng2-dragula/ng2-dragula';
67

78
import { IRelatedVideo } from './models/related-video.model';
89
import { INotify } from './models/notify.model';
@@ -81,11 +82,31 @@ export class AppComponent implements OnInit {
8182
constructor(
8283
private youtube: YoutubeGetVideo,
8384
private shared: SharedService,
84-
private nwjs: NwjsService
85+
private nwjs: NwjsService,
86+
private dragula: DragulaService
8587
) {
8688
this._shared = shared;
8789
this._nwjs = nwjs;
8890
this.notify = this._shared.notify;
91+
dragula.setOptions('playlistVideos', {
92+
moves: (el, container, handle) => {
93+
return handle.className === 'video-item-settings';
94+
}
95+
});
96+
dragula.over.subscribe((value) => {
97+
const [e, el, container] = value.slice(1);
98+
this.addClass(el, 'ex-over');
99+
});
100+
dragula.out.subscribe((value) => {
101+
const [e, el, container] = value.slice(1);
102+
this.removeClass(el, 'ex-over');
103+
this.updatePlaylist();
104+
});
105+
dragula.drop.subscribe((value) => {
106+
const [e, el, container] = value.slice(1);
107+
this.removeClass(el, 'ex-over');
108+
this.updatePlaylist();
109+
});
89110
}
90111

91112
ngOnInit() {
@@ -103,6 +124,22 @@ export class AppComponent implements OnInit {
103124
this.getFeedVideos();
104125
}
105126

127+
private hasClass(el: any, name: string) {
128+
return new RegExp('(?:^|\\s+)' + name + '(?:\\s+|$)').test(el.className);
129+
}
130+
131+
private addClass(el: any, name: string) {
132+
if (!this.hasClass(el, name)) {
133+
el.className = el.className ? [el.className, name].join(' ') : name;
134+
}
135+
}
136+
137+
private removeClass(el: any, name: string) {
138+
if (this.hasClass(el, name)) {
139+
el.className = el.className.replace(new RegExp('(?:^|\\s+)' + name + '(?:\\s+|$)', 'g'), '');
140+
}
141+
}
142+
106143
// ---------------- Init player ----------------
107144

108145
savePlayer(player) {
@@ -205,6 +242,12 @@ export class AppComponent implements OnInit {
205242

206243
// ---------------- Playlist settings ----------------
207244

245+
updatePlaylist() {
246+
this.findPlaylistItem();
247+
this._shared.playlist = this.playlistVideos;
248+
this._shared.updatePlaylist();
249+
}
250+
208251
uploadPlaylist(event: Event) {
209252
const files = event['target'].files[0];
210253
if (files.length <= 0) {
@@ -273,11 +316,7 @@ export class AppComponent implements OnInit {
273316
this.currentPlaylistItem = -1;
274317
}
275318
this.playlistVideos.splice(i, 1);
276-
277-
this._shared.playlist.splice(i, 1);
278-
this._shared.updatePlaylist();
279-
280-
this.findPlaylistItem();
319+
this.updatePlaylist();
281320
}, 200);
282321
}
283322

@@ -300,6 +339,8 @@ export class AppComponent implements OnInit {
300339
listType = this._shared.historyVideos[i];
301340
}
302341

342+
console.log(listType);
343+
303344
if (typeof listType.id.videoId !== 'undefined') {
304345
playlistItem = this.playlistVideos.find(item => item.id.videoId === listType.id.videoId);
305346
} else {
@@ -308,11 +349,8 @@ export class AppComponent implements OnInit {
308349

309350
if (typeof playlistItem === 'undefined') {
310351
this.playlistVideos.push(listType);
352+
this.updatePlaylist();
311353

312-
this._shared.playlist.push(listType);
313-
this._shared.updatePlaylist();
314-
315-
this.findPlaylistItem();
316354
this._shared.triggerNotify('Added to playlist');
317355
this.updateNotify();
318356
this.scrollToBottom();

src/app/app.module.ts

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { ReactiveFormsModule } from '@angular/forms';
55
import { FormsModule } from '@angular/forms';
66
import { routes } from './app.router';
77

8+
import { DragulaModule } from 'ng2-dragula/ng2-dragula';
9+
810
import { AppComponent } from './app.component';
911
import { SharedService } from './shared/lists.service';
1012
import { NwjsService } from './shared/nwjs.service';
@@ -24,6 +26,7 @@ import { CategoryComponent } from './components/category/category.component';
2426
ReactiveFormsModule,
2527
YoutubePlayerModule,
2628
FormsModule,
29+
DragulaModule,
2730
routes
2831
],
2932
declarations: [

src/app/components/youtube-about.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h2>About</h2>
33
</div>
44
<div class="app-content">
5-
<p>This is a simple youtube web player and desktop player based on angular-cli 1.4, NWjs 0.25.2, ng2-youtube-player 0.0.3 (used for youtube iFrame API), SCSS (CSS3), HTML5 and webkit functions.</p>
5+
<p>This is a simple youtube web player and desktop player based on angular-cli 1.4, NWjs 0.25.2, ngx-youtube-player 0.1.0 (used for youtube iFrame API), SCSS (CSS3), HTML5 and webkit functions.</p>
66
<p>This player is compatible only with Chrome/webkit browsers.</p>
77
<p>The project status is beta.</p>
88
</div>

src/assets/scss/_global.scss

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ body {
1616
font-weight: 400;
1717
font-size: $f-14;
1818
line-height: 1.5;
19-
user-select: none;
2019
margin: 0;
2120
padding: 0;
2221
cursor: default;

src/assets/scss/_videos.scss

+29
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,28 @@ iframe {
238238
}
239239
}
240240

241+
.gu-transit {
242+
background-color: #c72020 !important;
243+
.video-item-hint {
244+
color: var(--c-white);
245+
border-color: var(--c-white);
246+
}
247+
}
248+
249+
.ex-over {
250+
background-color: rgba(255, 255, 255, 0.01) !important;
251+
border: 2px dashed rgba(255, 255, 255, 0.2) !important;
252+
.video-item:hover {
253+
.video-item-image {
254+
transform: scale(1);
255+
}
256+
.video-item-settings {
257+
opacity: 0;
258+
visibility: hidden;
259+
}
260+
}
261+
}
262+
241263
#related-video-list {
242264
display: flex;
243265
flex-wrap: wrap;
@@ -294,6 +316,13 @@ iframe {
294316
overflow: auto;
295317
background-color: var(--c-dark-gray);
296318
z-index: 0;
319+
border: 0 dashed transparent;
320+
transition: all 0.2s ease-out;
321+
.video-item-settings {
322+
cursor: grab;
323+
cursor: -moz-grab;
324+
cursor: -webkit-grab;
325+
}
297326
.video-item:not(.active) {
298327
background-color: transparent;
299328
}

src/index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
<html>
33
<head>
44
<base href="/">
5-
<title>YouTube Player v2.1</title>
5+
<title>YouTube Player v2.2</title>
66
<link rel="icon" href="favicon.ico">
77
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
88
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
9-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css.map">
109
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
1110
</head>
1211
<body class="">

0 commit comments

Comments
 (0)