Trying to add an audio file to an article. I have an audio field (link field) set to use mediaelement and get the error above when displaying the article. There is a black box where the player should be and a download link which only points to my front page.

It's possible I do not have this set up correctly as I have had trouble finding clear documentation on creating an audio field.
It seemed (from the documentation) that when I go to create a new field there should be an "audio" field type once mediaelement is installed but that is not the case. So I installed Media and set the audio field display type there to mediaelement.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lyricnz’s picture

I have the same issue:

- start from empty D7 site
- download and enable Link (7.x-1.0) module and Mediaelement module (7.x-1.1)
- add a Link field to Article with default settings
- change the display of the field to MediaElement Audio
- create an article, set the URL to something - I used http://www.robtowns.com/music/blind_willie.mp3
- view article, error emitted

Problem is caused by mediaelement using $item['uri'] - when the actual url is stored in $item['url']

lyricnz’s picture

This was caused by commit http://drupalcode.org/project/mediaelement.git/commit/6192196 which refers to compatability with Media module. I am not using Media module at all.

lyricnz’s picture

Status: Active » Needs review
FileSize
995 bytes

Here is a patch that re-implements the functionality removed in the commit above - but checks for link_field in particular, rather than file.

lyricnz’s picture

Updated patch, with a fix relating to url query parameters from #1177430: Query parameters are stripped for link field.

lyricnz’s picture

Hmmm.. it seems that adding query parameters to the URL breaks the control (I get just a black box). Put that "needs review" back to #3 until I sort it out.

robbielink’s picture

#3 failed for me but I'm new to patching and realized I had already patched that module with #9 from #1170536:Undefined variable: link_types in mediaelement_field_formatter_settings_form().
Can you use the patch command to add another patch or do you have to do it manually? Seems like the line numbers would have changed.

lyricnz’s picture

You can "patch -R" to unapply that patch, then apply this one.

robbielink’s picture

Sorry, but I'm confused (new to Drupal)....
Since the other patch I applied appeared to correct an error I was getting I assume I want to keep that patch and also apply yours. In which case it sounds like you're saying the answer to my general question is that no, you can't auto patch an already patched module - it has to be done manually.

Or are you saying that I don't need the other patch if I apply this one and so I should reverse the previous patch and just add this one?

Or is the idea that perhaps I do need the other patch but I should unapply it in order to test your patch and then go from there?
And if that is the case, is it safe to say that the proper way to test a patch is to work only with the original unpatched module?
(The more I think about it it seems that this last thought is what's going on).

Sorry for these general questions - just trying to understand how things work around here. Thanks!

robbielink’s picture

OK - trying to get into the spirit of things here....
Went back to a clean copy of mediaelement.module and applied patch #3.

Hunk #1 FAILED at 129.
Hunk #2 succeeded at 120 (offset -26 lines).

What am I doing wrong?

Edit: Scratch that complaint - my installation of this module may be corrupted in some other way. After that last patch going to the config screen just brought up a blank blue screen (wow - haven't seen that since dumping Windows!).
I'll reinstall and start from scratch tomorrow.

lyricnz’s picture

You probably did it right - I just tried this on a stock 7.x-1.1 download, and got the same error with Hunk 2. My patch is actually against the latest code in git 7.x-2.x branch - it's a bit unclear what the module maintainer is doing with this branch vs main. Here's a patch against git trunk (which is the same as 7.x-1.1)

robbielink’s picture

#10 worked for me.
Interestingly - the other patch I mentioned in post #6 is apparently not needed now. I applied your patch over a clean version of the module and get no more errors and the player displays fine and works fine.

chrowe’s picture

#10 worked for me as well.

Drupal 7.10
MediaElement.js 7.x-1.1

scottrigby’s picture

Status: Needs review » Reviewed & tested by the community

#10 is definitely a better solution than #1248572: Support for the Link Module, and works like a charm.

Dave Reid’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed with a few trivial modifications (and used the wrong issue # in the commit message, oops).
http://drupalcode.org/project/mediaelement.git/commit/53eee42

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.