zen-audio-player.github.io icon indicating copy to clipboard operation
zen-audio-player.github.io copied to clipboard

Create A To-Be-Played and Have-Played Queue

Open artforlife opened this issue 8 years ago • 43 comments

We could add a queue, similar to that of Mixcloud (bottom bar) that shows the things one played recently or allows to queue things to be played next.

artforlife avatar Jul 27 '16 19:07 artforlife

I am working on issue #222. Along with the basic feature, I am also keeping track of the songs played till now (it's stored in a browser session variable ). That can be integrated into a GUI to show 'played recently' and a 'new queue' ?

cipher1729 avatar Jul 27 '16 23:07 cipher1729

Is there a separate branch for your feature?

artforlife avatar Jul 28 '16 02:07 artforlife

@artforlife Is there something we still need to do for this if #222 and #1 are added?

shakeelmohamed avatar Jul 28 '16 06:07 shakeelmohamed

@artforlife No, there's no branch in the main repo for my feature. I'm still pushing changes to my fork, in the 'autoplay' branch

cipher1729 avatar Jul 28 '16 08:07 cipher1729

@shakeelmohamed Well, I do not use the Youtube playlist feature. What is it like in a nutshell? I am envisioning a sort of To-Play-Later queue. Think of this as bookmarking certain things with intention to return to them later.

artforlife avatar Jul 28 '16 09:07 artforlife

@artforlife that's basically it. YouTube actually has a special "watch later" playlist designed just for this purpose

shakeelmohamed avatar Jul 29 '16 00:07 shakeelmohamed

Is there a PR for this yet? Perhaps we can see a screenshot or something.

artforlife avatar Aug 08 '16 16:08 artforlife

@artforlife there is no PR yet

shakeelmohamed avatar Aug 09 '16 04:08 shakeelmohamed

We discussed some ideas in #212, tying this "later" playlist to YouTube/Soundcloud accounts is my preferred approach.

shakeelmohamed avatar Sep 22 '16 06:09 shakeelmohamed

FYI, we can use Auth0 for free until we week 7k users - not likely to happen 😄 The full tutorial is here we'd just need to request the appropriate YouTube permission scope for Google account login.

~~I'm not sure how we'd handle Soundcloud if we went that route... any ideas?~~ edit: looks like Auth0 supports SoundCloud so that's a non-issue: https://auth0.com/docs/identityproviders however, I'm not sure how we'd handle "mixed" playlists

shakeelmohamed avatar Oct 01 '16 01:10 shakeelmohamed

I would like to start working on this issue if possible 😄 , my approach will be:

  • Store the videos the user have played in a queue (which is stored in localStorage)
  • When the user selects one video from the queue, the video will start playing (the queue will be displayed below the "Click for Demo" button)
  • The user can delete videos from the playing queue.
  • Allow the user to drag/rearrange videos in the queue.
  • Enable adding videos to the queue from the search result list (for playing them in the future).

Has anybody finished developing any of these points or shall I start from scratch ?

i-radwan avatar Oct 08 '16 09:10 i-radwan

@hemoali thanks for jumping in!

I see this feature as a 2 part implementation:

  1. Add the Auth0 authentication flow to authenticate with YouTube via Oauth. Then using the authentication token, retrieve items from the users's YouTube "Watch Later" playlist.
  2. Integrate with some of the work in #244 to deal with the playback of the playlist.

shakeelmohamed avatar Oct 08 '16 20:10 shakeelmohamed

@shakeelmohamed I'm working on it now, but I've some problems with YouTube API authentication using the tokens retrieved from Auth0 (cannot find the right flow). However, I'll keep searching and if you have any advice/tutorial, it will be much appreciated 😄

i-radwan avatar Oct 10 '16 19:10 i-radwan

@hemoali did you see this guide? https://auth0.com/docs/quickstart/spa/jquery

shakeelmohamed avatar Oct 10 '16 20:10 shakeelmohamed

@shakeelmohamed Yeah sure, I've followed this tutorial and the last piece of it (https://auth0.com/docs/quickstart/spa/jquery/08-calling-apis) gave me the 401 error when calling the YouTube API. However, from what I've understood (from the searches I've been doing) that the access token of the services we need to use (e.g. YouTube) is kept hidden for security reasons, and to get this access_token we have to send a request using our application client_secret key (which is provided by Auth0), and to keep this secret key secret we need a back-end which will be called from the client side (passing the token-id generated on the client side), then on the back-end, by using the secret key, we can get the access_token of the service (e.g. YouTube) and then use it to get the required data and return it to the client side. However, I think there's another easier flow (because if this is the only available flow, this means that Auth0 isn't useful as it could be), but I cannot figure one right now 😄

i-radwan avatar Oct 10 '16 20:10 i-radwan

Well looks like this is the correct flow to achieve a secure process 😄 screen shot 2016-10-10 at 10 23 34 pm

i-radwan avatar Oct 10 '16 20:10 i-radwan

@shakeelmohamed I've tried the Google APIs, and the authentication process went very well. But the shock was that YouTube API disabled the access to "Watch Later" and "Watch History" from the API after Sep. 15 2016 😞 as shown here

screen shot 2016-10-11 at 12 34 54 am

I will try to find a workaround (although that a simple search revealed no solution 😞). Now I think we may make our own queue and then sync it with playlist into YouTube/Soundcloud

i-radwan avatar Oct 10 '16 22:10 i-radwan

@hemoali ouch. I know I ran into this on another project, https://github.com/shakeelmohamed/youtube-watch-later/issues/2 but I didn't realize the data simply isn't available anymore.

One workaround (so we don't have to deal with a database) is using a "Zen Audio Player" playlist (create it if it doesn't exit).

shakeelmohamed avatar Oct 10 '16 22:10 shakeelmohamed

Just to keep others updated:

What I've added:

  • Sign the user in using Google Javascript Library (OAuth2).
  • Create the app playlist named 'Zen Audio Player'. If the user already has a playlist with this name, the app will use it instead of making new one (To handle clearing localStorage or using Zap across many devices).
  • When the user plays a video, it gets added to the playlist (unless it's already added).

What I'm planning to add:

  • Display this playlist as a queue allowing the user to see it and play its videos.
  • Allow the user to delete videos from this playlist.

Suggestion:

  • Depending on statistics, will caching the videos as mp3 files on the server be a user-demanded service? As I think most users who use such service want to listen to some videos without consuming their data packages and without waiting for videos to load. We can offer this conversion service as paid service or special service for the users who use the app often.

i-radwan avatar Oct 12 '16 20:10 i-radwan

Overall though, I think you've got the right approach for the implementation. I'm excited to see the PR 🎉

will caching the videos as mp3 files on the server be a user-demanded service?

@hemoali I'm not interested in entering the copyright infringement legal mess around this feature. Moreover, the website is 100% hosted by GitHub pages for free and there is no "backend" server to host mp3s. We don't support mobile devices, so I don't see an issue around data usage for most users. There are several other services that will allow you to download mp3s from YouTube videos, let's leave that to the experts 😄 Monetizing sounds appealing, but I wouldn't have open-sourced this project if I cared about profitability.

shakeelmohamed avatar Oct 12 '16 21:10 shakeelmohamed

Is this issue still up for grabs? Would very much like to make a basic playlist functionality on this? without using 0Auth just localStorage and maybe also another button to share that playlist.

Utkarshbhimte avatar Jun 27 '17 18:06 Utkarshbhimte

@Utkarshbhimte yep, go for it!

shakeelmohamed avatar Jun 27 '17 18:06 shakeelmohamed

what's the status of this issue? I think I could make multiple playlist on localstorage here, that'd be great I think for us to listen to multiple group of songs and keeping it simple at the same time. 👍 what do you think?

andy-shi88 avatar Jul 13 '17 15:07 andy-shi88

@andy-shi88 this hasn't implemented yet, go for it if you're interested!

shakeelmohamed avatar Jul 13 '17 18:07 shakeelmohamed

I think that my last pull request closes this issue also. Tell me if am I right or there's still something to work on the issue.

avalan4e57 avatar Jul 28 '17 16:07 avalan4e57

@avalan4e57 I think this issue is asking for a different feature than #258, @artforlife can you verify?

shakeelmohamed avatar Jul 31 '17 21:07 shakeelmohamed

Is it still open? I'd like to have a shot on it. I'd try without OAuth, just localStorage.

chandan1794 avatar Oct 02 '18 11:10 chandan1794

@chandan1794 go for it!

shakeelmohamed avatar Oct 02 '18 16:10 shakeelmohamed

Me and a fellow student is doing a course in project development for our software engineering bachelor. We'd like to have a go at implementing a version of this functionality. Both creating new playlists as well as using the API to load existing YouTube ones as an alternative for continuous playing. Any pointers appreciated, especially additional requirements/wishes for the finished outcome. We have 4 weeks set aside for the construction process.

EvaThil avatar Feb 13 '19 05:02 EvaThil

@EvaThil Very cool! Feel free to ping me on Gitter and we can find some time to chat more in depth about meeting the goals of your course.

There was a decent amount of work done in #291 but seems to have been abandoned, feel free to use that as a starting point.

shakeelmohamed avatar Feb 13 '19 05:02 shakeelmohamed