Skip to content

Commit

Permalink
Showing bitrate is optional as it involves an extra request to the se…
Browse files Browse the repository at this point in the history
…rver and the installation of 'exiftool'.

Added a version string.

Updated README.md.
  • Loading branch information
CelliesProjects committed May 5, 2019
1 parent d5de2d5 commit d73b284
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# html5_audioplayer

html5_audioplayer provides an easy way to stream the music from your lamp server.
html5_audioplayer provides an easy way to stream the music from your lamp server.
<br>It is intended as a replacement for the Apache plugin `mod_musicindex` which was a pain to install and is not maintained anymore.
<br><br>html5_audioplayer is a simple one-file drop-in musicplayer.
<br>Just symlink `htdocs` to the root of your music collection and copy `index.php` to that folder and it works.
Expand All @@ -12,6 +12,14 @@ html5_audioplayer on a Samsung Galaxy S5 NEO Android phone.
- A working Apache webserver with PHP enabled.<br>
Actual versions should not matter that much but the player is developed against Apache 2.4 and PHP 7.
- A folder with MP3s, OGGs and/or WAV files.
- (Optionally) `exiftool` to show the bitrate. Default setting is to not show the bitrate.

To show the bitrate of the currently playing song `$showBitrate` in `index.php` has to be set to `true` and `exiftool` has to be installed.
<br>To install `exiftool` enter the following in a terminal:
<br>
````
sudo apt-get install exiftool
````

### Easy setup:
With Apache 2.4, easiest setup is to symlink `htdocs` to the folder where you keep your music files.
Expand Down
6 changes: 5 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
//error_reporting(E_ALL);
$showBitrate=true; //set to true to show bitrate, and install 'exiftool', check the README.md
$versionString="v0.99b";
if(isset($_GET["folder"]))
{
$path=rawurldecode($_GET["folder"]);
Expand Down Expand Up @@ -248,7 +250,7 @@
<div id="navList" class="noselect"></div>
<div id="playList" class="noselect"></div>
<div id="playerControls" class="noselect">
<div id="currentPlaying"><a href="https://github.com/CelliesProjects/html5_audioplayer" target="_blank">html5_audioplayer v0.9</a></div>
<div id="currentPlaying"><a href="https://github.com/CelliesProjects/html5_audioplayer" target="_blank">html5_audioplayer <?php echo $versionString ?></a></div>
<div id="controlArea"><img id="previousButton" class="actionIcon" src="?icon=previous"><img id="playButton" class="actionIcon" src="?icon=play"><img id="nextButton" class="actionIcon" src="?icon=next"><input type="range" min="0" max="0" value="0" class="" id="slider"><p id="currentTime"></p><img id="clearList" class="actionIcon" src="?icon=clearlist"></div>
<audio controls autoplay id="player">Your browser does not support the audio element.</audio>
<script>
Expand Down Expand Up @@ -461,6 +463,7 @@ function resetPlayer()
var nowPlaying=player.src;
if($('.playListLink').eq(currentSong).data('path')!=undefined)thisSong=encodeURIComponent($('.playListLink').eq(currentSong).data('path'))+'/';
thisSong+=encodeURIComponent($('.playListLink').eq(currentSong).text());
<?php if($showBitrate):?>
$.get('?bitrate='+thisSong,function(){
})
.done(function(data){
Expand All @@ -469,6 +472,7 @@ function resetPlayer()
.fail(function(){
console.log('error getting bitrate');
});
<?php endif;?>
});

player.addEventListener('playing',function()
Expand Down

0 comments on commit d73b284

Please sign in to comment.