podcast_publisher-1.0.0-alpha3/src/PodcastAudioService.php
src/PodcastAudioService.php
<?php
namespace Drupal\podcast_publisher;
use Drupal\file\FileInterface;
/**
* Service providing helper functions for audio file handling.
*/
class PodcastAudioService implements PodcastAudioServiceInterface {
/**
* {@inheritdoc}
*/
public function getDuration(FileInterface $file) {
$id3 = new \getID3();
$fileinfo = $id3->analyze($file->getFileUri());
return $fileinfo['playtime_string'] ?? '0';
}
}
