Hi,

I'm just starting tolearn D7 and audiofield, so I hope that my question is a pertinent one.

Is it possible to have one of the players inline?
I mean to have text after the player, so basically to chooe exactly where you would like the player to occur in one page.

At the moment I can place the player only at the bottom of a page.

Thank you

Comments

tamerzg’s picture

Status: Active » Fixed

You can switch input format to php code in your textarea and then add following snippet wherever you want to render audio player (just replace field_audio with the name of your audiofield):

  $node=menu_get_object();
  $audiofile = file_create_url($node>field_audio['und'][0]['uri']);
  $info = pathinfo($audiofile);
  $op = $info['extension'];
  print audiofield_get_player($audiofile, $op);
chrisivens’s picture

I suppose a long way round would be to have a content type or entity purely for video content and then create a filter that renders the player for whichever node you specify using a short code. That's possibly the way I'd do it for reuse.

tbom’s picture

Hi,

I added the text below:

$node=menu_get_object(); 
$audiofile = file_create_url($node>Audio['und'][0]['uri']);
  $info = pathinfo($audiofile);  $op = $info['extension'];  print audiofield_get_player($audiofile, $op);

but I get this error:

public_html/modules/php/php.module(80) : eval()'d code on line 6

Can you please help

I replaced the field_audio with the name of my field (the name that I've added in the Content type)

Thank you

tbom’s picture

Is there any hope for some help on the error I got above?

thank you

tbom’s picture

I found the issue,

$audiofile = file_create_url($node->field_audio['und'][0]['uri']);

The minus sign "-" was missing, instead of $node>field_audio, it should be $node->field_audio... and now I get another error, I'll post it separately

Status: Fixed » Closed (fixed)

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