Version Description
None
Download this release
Release Info
Developer | mra13 |
Plugin | Compact WP Audio Player |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.4 to 1.5
- readme.txt +8 -2
- sc_audio_player.php +38 -13
readme.txt
CHANGED
@@ -3,8 +3,8 @@ 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.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
A Compact WP Audio Player Pluign that is compatible with all major browsers and devices (Android, iPhone)
|
@@ -53,7 +53,13 @@ None
|
|
53 |
None
|
54 |
|
55 |
== Changelog ==
|
|
|
|
|
|
|
56 |
1.4 - added a volume parameter option in the shortcode so you can specify the volume of the audio
|
|
|
57 |
1.3 - Added the autoplay option in the shortcode.
|
|
|
58 |
1.2 - added the ability to spcify a container class via the shortcode (helpful for CSS customization)
|
|
|
59 |
1.1 - minor javascript bug fix
|
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)
|
53 |
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
|
60 |
+
|
61 |
1.3 - Added the autoplay option in the shortcode.
|
62 |
+
|
63 |
1.2 - added the ability to spcify a container class via the shortcode (helpful for CSS customization)
|
64 |
+
|
65 |
1.1 - minor javascript bug fix
|
sc_audio_player.php
CHANGED
@@ -2,12 +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.
|
6 |
Author: Tips and Tricks HQ
|
7 |
Author URI: http://www.tipsandtricks-hq.com/
|
8 |
License: GPL2
|
9 |
*/
|
10 |
|
|
|
11 |
define('SC_AUDIO_BASE_URL', plugins_url('/',__FILE__));
|
12 |
|
13 |
add_action('init', 'wp_sc_audio_init');
|
@@ -24,25 +25,32 @@ function wp_sc_audio_init()
|
|
24 |
}
|
25 |
|
26 |
function scap_footer_code(){
|
|
|
|
|
27 |
?>
|
28 |
<script type="text/javascript">
|
29 |
soundManager.useFlashBlock = true; // optional - if used, required flashblock.css
|
30 |
soundManager.url = '<?php echo SC_AUDIO_BASE_URL; ?>swf/soundmanager2.swf';
|
31 |
-
function play_mp3(flg,ids,mp3url,volume){
|
32 |
soundManager.createSound({
|
33 |
id:'btnplay_'+ids,
|
34 |
volume: volume,
|
35 |
url: mp3url
|
36 |
});
|
37 |
-
|
38 |
if(flg == 'play'){
|
39 |
//soundManager.stopAll();
|
40 |
soundManager.play('btnplay_'+ids,{
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
else if(flg == 'stop'){
|
48 |
//soundManager.stop('btnplay_'+ids);
|
@@ -58,6 +66,11 @@ function scap_footer_code(){
|
|
58 |
document.getElementById('btnplay_'+ids).style.display = 'inline';
|
59 |
document.getElementById('btnstop_'+ids).style.display = 'none';
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
</script>
|
63 |
<?php
|
@@ -71,17 +84,19 @@ function sc_embed_player_handler($atts, $content = null)
|
|
71 |
'autoplay' => '',
|
72 |
'volume' => '',
|
73 |
'class' => '',
|
|
|
74 |
), $atts));
|
75 |
if(empty($fileurl)){
|
76 |
return '<div style="color:red;font-weight:bold;">Compact Audio Player Error! You must enter the mp3 file URL via the "fileurl" parameter in this shortcode. Please check the documentation and correct the mistake.</div>';
|
77 |
}
|
78 |
if(empty($volume)){$volume = '80';}
|
79 |
if(empty($class)){$class = "sc_player_container1";}//Set default container class
|
|
|
80 |
$ids = uniqid();
|
81 |
-
|
82 |
$player_cont = '<div class="'.$class.'">';
|
83 |
-
$player_cont .= '<input type="button" id="btnplay_'.$ids.'" class="myButton_play" onClick="play_mp3(\'play\',\''.$ids.'\',\''.$fileurl.'\',\''.$volume.'\');show_hide(\'play\',\''.$ids.'\');" />';
|
84 |
-
$player_cont .= '<input type="button" id="btnstop_'.$ids.'" style="display:none" class="myButton_stop" onClick="play_mp3(\'stop\',\''.$ids.'\',\'\',\''.$volume.'\');show_hide(\'stop\',\''.$ids.'\');" />';
|
85 |
$player_cont .= '<div id="sm2-container"><!-- flash movie ends up here --></div>';
|
86 |
$player_cont .= '</div>';
|
87 |
|
@@ -97,7 +112,18 @@ soundManager.setup({
|
|
97 |
volume: '$volume',
|
98 |
url: '$fileurl'
|
99 |
});
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
document.getElementById('btnplay_$ids').style.display = 'none';
|
102 |
document.getElementById('btnstop_$ids').style.display = 'inline';
|
103 |
},
|
@@ -135,4 +161,3 @@ function scap_mp3_options()
|
|
135 |
echo '<p><code>[sc_embed_player fileurl="http://www.example.com/wp-content/uploads/my-music/mysong.mp3"]</code></p>';
|
136 |
echo '</div>';
|
137 |
}
|
138 |
-
?>
|
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');
|
25 |
}
|
26 |
|
27 |
function scap_footer_code(){
|
28 |
+
$debug_marker = "<!-- WP Audio player plugin v" . SC_AUDIO_PLUGIN_VERSION . " - http://www.tipsandtricks-hq.com/wordpress-audio-music-player-plugin-4556/ -->";
|
29 |
+
echo "\n${debug_marker}\n";
|
30 |
?>
|
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,
|
38 |
url: mp3url
|
39 |
});
|
40 |
+
|
41 |
if(flg == 'play'){
|
42 |
//soundManager.stopAll();
|
43 |
soundManager.play('btnplay_'+ids,{
|
44 |
+
onfinish: function() {
|
45 |
+
if(loops == 'true'){
|
46 |
+
loopSound('btnplay_'+ids);
|
47 |
+
}
|
48 |
+
else{
|
49 |
+
document.getElementById('btnplay_'+ids).style.display = 'inline';
|
50 |
+
document.getElementById('btnstop_'+ids).style.display = 'none';
|
51 |
+
}
|
52 |
+
}
|
53 |
+
});
|
54 |
}
|
55 |
else if(flg == 'stop'){
|
56 |
//soundManager.stop('btnplay_'+ids);
|
66 |
document.getElementById('btnplay_'+ids).style.display = 'inline';
|
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
|
84 |
'autoplay' => '',
|
85 |
'volume' => '',
|
86 |
'class' => '',
|
87 |
+
'loops' => '',
|
88 |
), $atts));
|
89 |
if(empty($fileurl)){
|
90 |
return '<div style="color:red;font-weight:bold;">Compact Audio Player Error! You must enter the mp3 file URL via the "fileurl" parameter in this shortcode. Please check the documentation and correct the mistake.</div>';
|
91 |
}
|
92 |
if(empty($volume)){$volume = '80';}
|
93 |
if(empty($class)){$class = "sc_player_container1";}//Set default container class
|
94 |
+
if(empty($loops)){$loops = "false";}
|
95 |
$ids = uniqid();
|
96 |
+
|
97 |
$player_cont = '<div class="'.$class.'">';
|
98 |
+
$player_cont .= '<input type="button" id="btnplay_'.$ids.'" class="myButton_play" onClick="play_mp3(\'play\',\''.$ids.'\',\''.$fileurl.'\',\''.$volume.'\',\''.$loops.'\');show_hide(\'play\',\''.$ids.'\');" />';
|
99 |
+
$player_cont .= '<input type="button" id="btnstop_'.$ids.'" style="display:none" class="myButton_stop" onClick="play_mp3(\'stop\',\''.$ids.'\',\'\',\''.$volume.'\',\''.$loops.'\');show_hide(\'stop\',\''.$ids.'\');" />';
|
100 |
$player_cont .= '<div id="sm2-container"><!-- flash movie ends up here --></div>';
|
101 |
$player_cont .= '</div>';
|
102 |
|
112 |
volume: '$volume',
|
113 |
url: '$fileurl'
|
114 |
});
|
115 |
+
var auto_loop = '$loops';
|
116 |
+
mySound.play({
|
117 |
+
onfinish: function() {
|
118 |
+
if(auto_loop == 'true'){
|
119 |
+
loopSound('btnplay_$ids');
|
120 |
+
}
|
121 |
+
else{
|
122 |
+
document.getElementById('btnplay_$ids').style.display = 'inline';
|
123 |
+
document.getElementById('btnplay_$ids').style.display = 'none';
|
124 |
+
}
|
125 |
+
}
|
126 |
+
});
|
127 |
document.getElementById('btnplay_$ids').style.display = 'none';
|
128 |
document.getElementById('btnstop_$ids').style.display = 'inline';
|
129 |
},
|
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 |
}
|
|