Compact WP Audio Player - Version 1.6

Version Description

None

Download this release

Release Info

Developer mra13
Plugin Icon 128x128 Compact WP Audio Player
Version 1.6
Comparing to
See all releases

Code changes from version 1.5 to 1.6

Files changed (2) hide show
  1. readme.txt +5 -3
  2. sc_audio_player.php +63 -10
readme.txt CHANGED
@@ -3,11 +3,11 @@ Contributors: Tips and Tricks HQ
3
  Donate link: http://www.tipsandtricks-hq.com/development-center
4
  Tags: audio, audio player, embed, media, media player, mp3, mp3 player, music, music player, player, podcast, sound
5
  Requires at least: 3.0
6
- Tested up to: 3.6
7
- Stable tag: 1.5
8
  License: GPLv2 or later
9
 
10
- A Compact WP Audio Player Pluign that is compatible with all major browsers and devices (Android, iPhone)
11
 
12
  == Description ==
13
 
@@ -54,6 +54,8 @@ None
54
 
55
  == Changelog ==
56
 
 
 
57
  1.5 - added a auto loop parameter option in the shortcode to automatically loop the audio file
58
 
59
  1.4 - added a volume parameter option in the shortcode so you can specify the volume of the audio
3
  Donate link: http://www.tipsandtricks-hq.com/development-center
4
  Tags: audio, audio player, embed, media, media player, mp3, mp3 player, music, music player, player, podcast, sound
5
  Requires at least: 3.0
6
+ Tested up to: 3.6.1
7
+ Stable tag: 1.6
8
  License: GPLv2 or later
9
 
10
+ A Compact WP Audio Player Pluign that is compatible with all major browsers and devices (Android, iPhone, iPad)
11
 
12
  == Description ==
13
 
54
 
55
  == Changelog ==
56
 
57
+ 1.6 - Added an option to disable simultaneous playback. It will automatically stop the audio file that is currently playing when a user plays a new file.
58
+
59
  1.5 - added a auto loop parameter option in the shortcode to automatically loop the audio file
60
 
61
  1.4 - added a volume parameter option in the shortcode so you can specify the volume of the audio
sc_audio_player.php CHANGED
@@ -2,13 +2,13 @@
2
  /*
3
  Plugin Name: Compact Audio Player
4
  Description: Plays a specified audio file (.mp3 or .ogg) using a simple and compact audio player. The audio player is compatible with all major browsers and devices (Android, iPhone).
5
- Version: 1.5
6
  Author: Tips and Tricks HQ
7
  Author URI: http://www.tipsandtricks-hq.com/
8
  License: GPL2
9
  */
10
 
11
- define('SC_AUDIO_PLUGIN_VERSION', '1.5');
12
  define('SC_AUDIO_BASE_URL', plugins_url('/',__FILE__));
13
 
14
  add_action('init', 'wp_sc_audio_init');
@@ -31,7 +31,8 @@ function scap_footer_code(){
31
  <script type="text/javascript">
32
  soundManager.useFlashBlock = true; // optional - if used, required flashblock.css
33
  soundManager.url = '<?php echo SC_AUDIO_BASE_URL; ?>swf/soundmanager2.swf';
34
- function play_mp3(flg,ids,mp3url,volume,loops){
 
35
  soundManager.createSound({
36
  id:'btnplay_'+ids,
37
  volume: volume,
@@ -39,7 +40,11 @@ function scap_footer_code(){
39
  });
40
 
41
  if(flg == 'play'){
42
- //soundManager.stopAll();
 
 
 
 
43
  soundManager.play('btnplay_'+ids,{
44
  onfinish: function() {
45
  if(loops == 'true'){
@@ -57,7 +62,8 @@ function scap_footer_code(){
57
  soundManager.pause('btnplay_'+ids);
58
  }
59
  }
60
- function show_hide(flag,ids){
 
61
  if(flag=='play'){
62
  document.getElementById('btnplay_'+ids).style.display = 'none';
63
  document.getElementById('btnstop_'+ids).style.display = 'inline';
@@ -67,10 +73,24 @@ function scap_footer_code(){
67
  document.getElementById('btnstop_'+ids).style.display = 'none';
68
  }
69
  }
70
- function loopSound(soundID) {
 
71
  window.setTimeout(function() {
72
  soundManager.play(soundID,{onfinish:function(){loopSound(soundID);}});
73
  },1);
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
  </script>
76
  <?php
@@ -151,13 +171,46 @@ function scap_mp3_player_admin_menu() {
151
  function scap_mp3_options()
152
  {
153
  echo '<div class="wrap">';
154
- echo '<div id="icon-upload" class="icon32"><br></div><h2>SC Audio Player</h2><br />';
155
-
156
- echo '<p>Visit the <a href="http://www.tipsandtricks-hq.com/?p=4556" target="_blank">Compact Audio Player</a> plugin page for documentation and update.</p>';
 
157
  echo "<p>This is a Simple All Browser Supported Audio Player. There is no extra settings. Just add the shortcode with the MP3 file URL in a WordPress post or page to embed the audio player.</p>";
158
  echo "<h3>Shortcode Format</h3>";
159
  echo '<p><code>[sc_embed_player fileurl="URL OF THE MP3 FILE"]</code></p>';
160
  echo '<p><strong>Example:</strong></p>';
161
  echo '<p><code>[sc_embed_player fileurl="http://www.example.com/wp-content/uploads/my-music/mysong.mp3"]</code></p>';
162
- echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
2
  /*
3
  Plugin Name: Compact Audio Player
4
  Description: Plays a specified audio file (.mp3 or .ogg) using a simple and compact audio player. The audio player is compatible with all major browsers and devices (Android, iPhone).
5
+ Version: 1.6
6
  Author: Tips and Tricks HQ
7
  Author URI: http://www.tipsandtricks-hq.com/
8
  License: GPL2
9
  */
10
 
11
+ define('SC_AUDIO_PLUGIN_VERSION', '1.6');
12
  define('SC_AUDIO_BASE_URL', plugins_url('/',__FILE__));
13
 
14
  add_action('init', 'wp_sc_audio_init');
31
  <script type="text/javascript">
32
  soundManager.useFlashBlock = true; // optional - if used, required flashblock.css
33
  soundManager.url = '<?php echo SC_AUDIO_BASE_URL; ?>swf/soundmanager2.swf';
34
+ function play_mp3(flg,ids,mp3url,volume,loops)
35
+ {
36
  soundManager.createSound({
37
  id:'btnplay_'+ids,
38
  volume: volume,
40
  });
41
 
42
  if(flg == 'play'){
43
+ <?php
44
+ if(get_option('sc_audio_disable_simultaneous_play') == '1'){
45
+ echo 'stop_all_tracks();';
46
+ }
47
+ ?>
48
  soundManager.play('btnplay_'+ids,{
49
  onfinish: function() {
50
  if(loops == 'true'){
62
  soundManager.pause('btnplay_'+ids);
63
  }
64
  }
65
+ function show_hide(flag,ids)
66
+ {
67
  if(flag=='play'){
68
  document.getElementById('btnplay_'+ids).style.display = 'none';
69
  document.getElementById('btnstop_'+ids).style.display = 'inline';
73
  document.getElementById('btnstop_'+ids).style.display = 'none';
74
  }
75
  }
76
+ function loopSound(soundID)
77
+ {
78
  window.setTimeout(function() {
79
  soundManager.play(soundID,{onfinish:function(){loopSound(soundID);}});
80
  },1);
81
+ }
82
+ function stop_all_tracks()
83
+ {
84
+ soundManager.stopAll();
85
+ var inputs = document.getElementsByTagName("input");
86
+ for (var i = 0; i < inputs.length; i++) {
87
+ if(inputs[i].id.indexOf("btnplay_") == 0){
88
+ inputs[i].style.display = 'inline';//Toggle the play button
89
+ }
90
+ if(inputs[i].id.indexOf("btnstop_") == 0){
91
+ inputs[i].style.display = 'none';//Hide the stop button
92
+ }
93
+ }
94
  }
95
  </script>
96
  <?php
171
  function scap_mp3_options()
172
  {
173
  echo '<div class="wrap">';
174
+ echo '<div id="poststuff"><div id="post-body">';
175
+ echo '<div id="icon-upload" class="icon32"><br></div><h2>SC Audio Player</h2>';
176
+
177
+ echo '<div style="background: #FFF6D5; border: 1px solid #D1B655; color: #3F2502; padding: 15px 10px">Visit the <a href="http://www.tipsandtricks-hq.com/wordpress-audio-music-player-plugin-4556" target="_blank">Compact Audio Player</a> plugin page for documentation and update.</div>';
178
  echo "<p>This is a Simple All Browser Supported Audio Player. There is no extra settings. Just add the shortcode with the MP3 file URL in a WordPress post or page to embed the audio player.</p>";
179
  echo "<h3>Shortcode Format</h3>";
180
  echo '<p><code>[sc_embed_player fileurl="URL OF THE MP3 FILE"]</code></p>';
181
  echo '<p><strong>Example:</strong></p>';
182
  echo '<p><code>[sc_embed_player fileurl="http://www.example.com/wp-content/uploads/my-music/mysong.mp3"]</code></p>';
183
+
184
+ if(isset($_POST['sc_audio_player_settings'])){
185
+ update_option('sc_audio_disable_simultaneous_play', isset($_POST["sc_audio_disable_simultaneous_play"])?'1':'');
186
+ }
187
+ ?>
188
+ <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
189
+
190
+ <div class="postbox">
191
+ <h3><label for="title">Audio Player Settings</label></h3>
192
+ <div class="inside">
193
+
194
+ <table class="form-table">
195
+
196
+ <tr valign="top"><td width="25%" align="left">
197
+ Disable Simultaneous Play:
198
+ </td><td align="left">
199
+ <input name="sc_audio_disable_simultaneous_play" type="checkbox"<?php if(get_option('sc_audio_disable_simultaneous_play')!='') echo ' checked="checked"'; ?> value="1"/>
200
+ <br /><p class="description">Check this option if you only want to allow one audio file to be played at a time (helpful if you have multiple audio files on a page). It will automatically stop the audio file that is currently playing when a user plays a new file.</p>
201
+ </td></tr>
202
+
203
+ </table>
204
+
205
+ <div class="submit">
206
+ <input type="submit" class="button-primary" name="sc_audio_player_settings" value="<?php _e('Update'); ?>" />
207
+ </div>
208
+
209
+
210
+ </div></div>
211
+ </form>
212
+
213
+ <?php
214
+ echo '</div></div>';//end of post-stuff
215
+ echo '</div>';//end of wrap
216
  }