diff --git a/README.md b/README.md index 67b7bf6..eeabb68 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ Vynchronize is a online video synchronization platform where you can watch videos online with friends in real time! -This is a work in progress, and it is only in the beta stages. Don't expect it to be perfect! - Vynchronize currently supports YouTube, Daily Motion, and Vimeo! [![forthebadge](https://forthebadge.com/images/badges/60-percent-of-the-time-works-every-time.svg)](http://forthebadge.com) @@ -180,3 +178,8 @@ io.sockets.adapter.rooms['room-'+roomnum] The Queue object consists of arrays for each specific player. Each array then consists of objects that hold both the id and title. It was created this way because grabbing the title required extra work, and could not be done continuously on the spot. + +##### In Depth Functionality + +Please see the [Wiki](https://github.com/kyle8998/Vynchronize/wiki) for more +information. diff --git a/index.html b/index.html index 6629796..dedeba0 100644 --- a/index.html +++ b/index.html @@ -272,7 +272,7 @@
-

*The synchronization is not perfect at the moment! It's a work in progress

+

*The synchronization may not be perfect! It's a work in progress, submit an issue on github if you wish to submit a bug report/suggestion.

@@ -499,7 +499,8 @@

About Vynchronize

var html = '' if (yt.length > 0) { for (i = 0; i < yt.length; i++) { - html += '
  • ' + yt[i].title + '
  • ' + html += '
  • ' + yt[i].title + '
  • ' } } else { html += '
  • ' @@ -511,11 +512,15 @@

    About Vynchronize

    // Remove the video from the queue at idx function removeAt(idx) { - socket.emit('remove at', { idx: idx }) + socket.emit('remove at', { + idx: idx + }) } function playAt(idx) { - socket.emit('play at', { idx: idx }, function(data){ + socket.emit('play at', { + idx: idx + }, function(data) { var videoId = data.videoId // Change the video diff --git a/js/notify.js b/js/notify.js index fdd677d..d907655 100644 --- a/js/notify.js +++ b/js/notify.js @@ -157,3 +157,26 @@ function playNextAlert() { z_index: 1031, }); } + +// When user enters a url, but the url is invalid +function invalidURL() { + $.notify({ + title: 'Error: ', + icon: 'fas fa-id-card', + message: "Entered invalid video url" + }, { + type: 'danger', + delay: 400, + animate: { + enter: 'animated fadeInUp', + exit: 'animated fadeOutRight' + }, + placement: { + from: "bottom", + align: "right" + }, + offset: 20, + spacing: 10, + z_index: 1031, + }) +} diff --git a/js/sync.js b/js/sync.js index bf48a53..c496c5d 100644 --- a/js/sync.js +++ b/js/sync.js @@ -127,7 +127,7 @@ function seekTo(time) { // This parses the ID out of the video link function idParse(videoId) { // If user enters a full link - if (videoId.includes("https://") || videoId.includes("http://")) { + if (videoId.includes("https://") || videoId.includes("http://") || videoId.includes(".com/")) { // Do some string processing with regex switch (currPlayer) { case 0: @@ -137,6 +137,7 @@ function idParse(videoId) { console.log("You entered a link, but you really meant " + match[1]) return match[1] } + videoId = "invalid" break; case 1: @@ -150,6 +151,7 @@ function idParse(videoId) { console.log("You entered a link, but you really meant " + match[1]) return match[1] } + videoId = "invalid" break; case 2: @@ -159,6 +161,7 @@ function idParse(videoId) { console.log("You entered a link, but you really meant " + match[1]) return match[1] } + videoId = "invalid" break; default: @@ -173,12 +176,18 @@ function enqueueVideo(roomnum) { var videoId = document.getElementById("inputVideoId").value; videoId = idParse(videoId) - // Actually change the video! - socket.emit('enqueue video', { - room: roomnum, - videoId: videoId, - user: username - }); + if (videoId != "invalid") { + // Actually change the video! + socket.emit('enqueue video', { + room: roomnum, + videoId: videoId, + user: username + }) + } + else { + console.log("User entered an invalid video url :(") + invalidURL() + } } // Empty Queue @@ -201,14 +210,20 @@ function changeVideo(roomnum) { var videoId = document.getElementById("inputVideoId").value; videoId = idParse(videoId) - var time = getTime() - console.log("The time is this man: " + time) - // Actually change the video! - socket.emit('change video', { - room: roomnum, - videoId: videoId, - time: time - }); + if (videoId != "invalid") { + var time = getTime() + console.log("The time is this man: " + time) + // Actually change the video! + socket.emit('change video', { + room: roomnum, + videoId: videoId, + time: time + }); + } + else { + console.log("User entered an invalid video url :(") + invalidURL() + } //player.loadVideoById(videoId); }