You are here

class JplayerPlayer in jPlayer 8.2

Same name in this branch
  1. 8.2 src/Plugin/AudioPlayer/JplayerPlayer.php \Drupal\audiofield\Plugin\AudioPlayer\JplayerPlayer
  2. 8.2 src/Plugin/Field/FieldFormatter/JplayerPlayer.php \Drupal\jplayer\Plugin\Field\FieldFormatter\JplayerPlayer

@AudioPlayer ( id = "jplayer_player", title =

Plugin annotation


@Translation("jPlayer mp3 player"),
  file_types = {
    "mp3",
  },
  description = "jPlayer audio player."
)

Hierarchy

  • class \Drupal\audiofield\Plugin\AudioPlayer\JplayerPlayer implements \Drupal\audiofield\AudioFieldPluginInterface

Expanded class hierarchy of JplayerPlayer

File

src/Plugin/AudioPlayer/JplayerPlayer.php, line 25
Contains \Drupal\audiofield\Plugin\AudioPlayer\DefaultMp3Player.

Namespace

Drupal\audiofield\Plugin\AudioPlayer
View source
class JplayerPlayer implements AudioFieldPluginInterface {

  /**
   * {@inheritdoc}
   */
  public function renderPlayer(FileInterface $file) {
    $file_uri = $file
      ->getFileUri();
    $url = Url::fromUri(file_create_url($file_uri));
    $markup = "<p>I am a jplayer audio player!</p><audio controls>\n                   <source src='" . $url
      ->toString() . "' type='audio/mpeg'>\n                   Your browser does not support the audio element.\n                   </audio>";
    return [
      '#markup' => Markup::create($markup),
    ];
  }

}

Members