integration jaudio-player
[mw_sourceml] / app / out / default / views / sources / source / player.php
1 <?php
2
3   $documents = $source["reference"] ? $source["reference"]["documents"] : $source["documents"];
4   if($documents) :
5   $mw_out = $this->helper("mw_helper_out");
6   $audio_files = array();
7   foreach($documents as $id_document => $document){
8     $ext = "";
9     if(($k = strrpos($document["url"], ".")) !== false) $ext = strtolower(substr($document["url"], $k + 1));
10     switch($ext){
11       case "ogg":
12         $audio_files[] = array(
13           "type" => "audio/ogg",
14           "src" => $document["url"]
15         );
16         break;
17       case "mp3":
18         $audio_files[] = array(
19           "type" => "audio/mp3",
20           "src" => $document["url"]
21         );
22         break;
23     }
24   }
25  if($audio_files) :
26
27 ?>
28 <audio id="audio_<?php echo $source["id"] ?>" preload="none">
29   <?php foreach($audio_files as $audio_file) : ?>
30   <source src="<?php echo $audio_file["src"] ?>" type="<?php echo $audio_file["type"] ?>" />
31   <?php endforeach; ?>
32   <?php
33
34     $waveform_file = $this->path("content")."waveforms/".$source["id"].".png";
35     if(file_exists($waveform_file)) :
36
37   ?>
38   <img class="waveform" src="<?php echo $waveform_file; ?>" alt="waveform" />
39   <?php endif; ?>
40 </audio>
41 <?php endif; endif; ?>