|
@@ -8,6 +8,7 @@ class MainPlayer {
|
|
|
constructor() {
|
|
|
|
|
|
this.playlist = new Playlist()
|
|
|
+ this.playlistVideos = () => window.playlist.el.getElementsByTagName("li")
|
|
|
this.config = {
|
|
|
currentIndex: 0,
|
|
|
loop: () => localStorage.getItem('loop'),
|
|
@@ -42,10 +43,19 @@ class MainPlayer {
|
|
|
}
|
|
|
},
|
|
|
previous: (elem) => {
|
|
|
-
|
|
|
+ if(window.curVideo >= 0) {
|
|
|
+ window.curVideo--
|
|
|
+ window.videoPlayer.src = this.playlistVideos()[window.curVideo].getAttribute('path');
|
|
|
+ window.videoPlayer.play()
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
next: (elem) => {
|
|
|
-
|
|
|
+ if(window.curVideo < this.playlistVideos().length - 1) {
|
|
|
+ window.curVideo++
|
|
|
+ window.videoPlayer.src = this.playlistVideos()[window.curVideo].getAttribute('path');
|
|
|
+ window.videoPlayer.play()
|
|
|
+ }
|
|
|
},
|
|
|
loop: (elem, act) => {
|
|
|
let swap = act ? false : true
|
|
@@ -159,7 +169,7 @@ class MainPlayer {
|
|
|
|
|
|
let self = this
|
|
|
window.videoPlayer.onended = function () {
|
|
|
- let playlistVideos = window.playlist.el.getElementsByTagName("li")
|
|
|
+ let playlistVideos = self.playlistVideos()
|
|
|
let looping = self.config.loop()
|
|
|
|
|
|
if (playlistVideos.length !== 0) {
|