Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Using Plangular without Soundcloud #43

Closed
JeanHules opened this issue Nov 16, 2014 · 4 comments
Closed

Using Plangular without Soundcloud #43

JeanHules opened this issue Nov 16, 2014 · 4 comments

Comments

@JeanHules
Copy link

Hello,

Great player and great code. I am looking to use your player, but with MP3s. Is that possible? I have an API (/tracks.json) that I am pulling the song data from for my site. I have tried to rework some of the code so that the plangular attribute (src) is the mp3 file url which on the html is being generated by an ng-repeat that is pulling from the API. So my quick question is what would need to change to bypass the soundcloud api get, and just use the mp3 file url as the src?

Thanks,
John

@jxnblk
Copy link
Owner

jxnblk commented Nov 22, 2014

I assume you figured this out? There is a basic audio player in there, if you want to use as a reference, but it might make more sense to build a simple one from scratch.

@JeanHules
Copy link
Author

Hey Brent,

Thank you for getting back to me on this issue. I am slowly figuring it
out. I am new to angular so its taking a little longer than it would
normally take. If I understand your code correctly, it takes a SC URL ,
runs it through the SC API to get the stream_url then creates the mp3 URL
with the streamurl in combination with the clientID.

The issue I am running into is bypassing the SC API process and using a mp3
url directly from my json response. I guess the way to solve that would be
to set the player.tracks:[ ] with the json response data.

I was wondering if you help answer a couple questions of mine. I am trying
to figure out how to turn your code into a simple JSON fed mp3 player. I
see the player.js code, but I am already pretty far into modifying this
existing plangular code to give up. Plus I am learning quite a bit about
angular from poking around. Though the one thing I am struggling with is
how to pass the json into the directive so that player.tracks = the json
response data. After getting the data down to the tracks:[ ], I am guessing
I will be able to poke around and figure the rest out.

I guess I also have to ask if doing that is the best way to do this? I made
a little Plunker environment. Could you take a look and let me know if you
have any suggestions, it would be greatly appreciated.

http://plnkr.co/edit/DeQkLOamYomizr6GMYdc?p=info

@jxnblk
Copy link
Owner

jxnblk commented Nov 23, 2014

Yeah I can take a look tomorrow or Monday, but you should remove your number from the comments since this is a public repo :)

@jxnblk
Copy link
Owner

jxnblk commented Nov 25, 2014

Sorry, I'm having trouble getting the plnkr to work. Seems like you might be referencing a different scope variable in your controller and in your index.html though.

Generally though, you might want to consider how to split up the handling of the tracks array and simplifying the player directive to just play one at a time, then use a directive or controller to handle the array and next/previous methods. Plangular does both so that it can be isolated, but I would split those two things out if I was building something custom. Or, maybe check out the source for https://github.com/jxnblk/SoundRad/ as there might be some useful examples there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants