You are here

DefaultMp3Player.php in AudioField 8

File

src/Plugin/AudioPlayer/DefaultMp3Player.php
View source
<?php

namespace Drupal\audiofield\Plugin\AudioPlayer;

use Drupal\Core\Field\FieldItemListInterface;
use Drupal\audiofield\AudioFieldPluginBase;

/**
 * Implements the Default HTML5 Audio Player plugin.
 *
 * @AudioPlayer (
 *   id = "default_mp3_player",
 *   title = @Translation("default HTML5 audio player"),
 *   description = @Translation("Default html5 player - built into HTML specification."),
 *   fileTypes = {
 *     "mp3", "mp4", "m4a", "3gp", "aac", "wav", "ogg", "oga", "flac", "webm",
 *   },
 *   libraryName = "default",
 * )
 */
class DefaultMp3Player extends AudioFieldPluginBase {

  /**
   * {@inheritdoc}
   */
  public function renderPlayer(FieldItemListInterface $items, $langcode, array $settings) {

    // Simply return the default constructor.
    return $this
      ->renderDefaultPlayer($items, $settings);
  }

  /**
   * {@inheritdoc}
   */
  public function checkInstalled($log_error = FALSE) {

    // This is built in to HTML5, so it is always "installed".
    return TRUE;
  }

}

Classes

Namesort descending Description
DefaultMp3Player Implements the Default HTML5 Audio Player plugin.