I'm writing a custom provider for emaudio that would allow icecast streams urls to be parsed into a player and the currently playing track.
In order to constantly update the current track, I've written some ajax to do so. However, I can't get it to work because the provider file isn't loaded when it needs to process hook_menu().
So, I need some help figuring out how best to alter emaudio to get this to work. We could have emaudio_menu() load the provider files and allow drupal to process their hook_menu(). But then how do you get it to load the provider file when the js function is requested?
I've attached the provider files in case you would like to review what I've done.
Help would be much appreciated!
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | emfield_icecast_1.patch | 17.43 KB | moonray |
| #3 | emaudio.icecast.patch | 14.58 KB | aaron |
| #2 | emfield_icecast.patch | 13.32 KB | moonray |
| #1 | emfield_icecast.patch | 13.32 KB | moonray |
| icecast.js_.txt | 545 bytes | moonray |
Comments
Comment #1
moonray commentedI found an elegant solution. See #345383.
Using that patch, here is the patch to add the update provider.
Comment #2
moonray commentedUpdate to the patch. The ajax wasn't updating the song beyond the first time. Now it is.
Comment #3
aaron commentedFirst iteration looks good. I added an hook_update_N function to rebuild the menu to grab our new emfield/icecast/js.
However, I'm getting the following errors after applying when adding existing emaudio provider content:
Additionally, as icecast is a non-standard item, it really needs documentation for editors and administrators as to how they would use it.
Thanks for the work so far!
Comment #4
moonray commentedAdded code to catch errors/exception.
Added documentation.
Attached new path. Please review and comment on any changes/additions needed.
Comment #5
alex ua commentedI'm having problems getting this to work. I applied the patch, added the crossdomain.xml and put 1.fm (which I found on the list of streams on icecast.org) into it, and then tried to add a stream.
First I received errors about unidentified indexes related to emaudio_icecast_form() since I didn't enter a username or password into the settings page. I changed that function to include the following, which got rid of the errors, but I'm not sure it worked:
I'm not sure if this is the correct way to address this, but when i first tried to add an emaudio node the $item array was empty, so the idea was to check to see if it existed first before trying to pull info from the array. What do you think?
The second problem I'm getting is the following error after attempting to add an emaudio node:
What url am I supposed to be embedding? I tried posting a bunch of urls, and all gave me this error.
Any ideas?
Comment #6
alex ua commentedComment #7
alex ua commentedThis never seems to have been completed. For the future it will need a media: Icecast module in order to work (see Media: Souncloud for an example on how to do this).