PluginProbe
StreamCast – bring live radio to your site with a sleek player / 2.0.0
StreamCast – bring live radio to your site with a sleek player v2.0.0
2.4.5 2.4.4 trunk 1.0 1.1 2.0.0 2.1.10 2.1.2 2.1.4 2.1.5 2.1.8 2.2.1 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 All 29 releases
streamcast / public / shortcode-free.php

shortcode-free.php in StreamCast – bring live radio to your site with a sleek player 2.0.0, at public/shortcode-free.php

140 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php //Lets register our shortcode
2 function sc_radio_player_cb($atts){
3 extract( shortcode_atts( array(
4
5 'id' => null,
6 'url' => null,
7 'background' => null,
8
9 ), $atts ) );
10 ?>
11 <?php ob_start(); ?>
12
13 <?php
14 $player_type=get_post_meta( $id, 'opt-radio', true );
15 $stream_url=get_post_meta( $id, 'stream_url', true );
16 $player_postiion="";
17 ?>
18 <div class="sc_radio">
19 <div style="display:<?php if(empty($stream_url)){echo 'block;';}else{echo 'none;';}?>">
20 <h2>Ooops ! You forgot to enter a stream url ! Please check Radio Player configuration </h2>
21 </div>
22
23 <?php
24
25
26
27 switch ($player_type) {
28 case 'advanced' : ?>
29
30
31 <div style="width:100%; overflow:hidden;">
32 <div class="streamcast<?php echo $id; ?>">
33 <ul class="playlist">
34
35 <li data-cover="<?php echo STP_PLUGIN_DIR."images/default.png"; ?>" data-artist="Station Name">
36 <a href="<?php echo $stream_url;?>"> Welcome Message</a>
37 </li>
38 </ul>
39 </div>
40 </div>
41 <style type="text/css">
42 .streamcast<?php echo $id; ?>{
43 margin:20px auto 0;
44 width: 390px;
45 padding-bottom: 30px;
46
47 }
48 .player{background: <?php echo get_post_meta( $id, 'background', true ); ?>!important;}
49
50 </style>
51 <script type="text/javascript">
52
53 jQuery(".streamcast<?php echo $id; ?>").musicPlayer({
54 autoPlay: "false",
55 volume: 65,
56 loop: false,
57 timeSeparator: ' / ',
58 playerAbovePlaylist: true,
59 infoElements: ['title' , 'artist'] ,
60 elements: ['artwork','information', 'controls', 'time', 'volume'],
61 timeElements: ['current'],
62 controlElements: [ 'play', 'stop'],
63 });
64
65 </script>
66
67
68
69
70
71
72 <?php
73 break;
74 case 'standard': ?>
75
76 <!-- BEGINS: RADIO PLAYER CODE -->
77 <script type="text/javascript">
78 MRP.insert({
79 'url':"<?php echo $stream_url; ?>",
80 'lang':'en',
81 'codec':'mp3',
82 'volume':65,
83 'autoplay':'false',
84 'forceHTML5':true,
85 'jsevents':true,
86 'buffering':0,
87 'title':'Station Name',
88 'welcome':'Welcome Message',
89 'wmode':'transparent',
90 'skin':'mcclean',
91 'width':400,
92 'height':100
93 });
94 jQuery("#musesContextMenuAboutDiv, #musesContextMenuTitleDiv, #musesContextMenuVersionDiv").css("display", "none");
95 </script>
96 <!-- ENDS: RADIO PLAYER CODE -->
97
98
99 <?php
100 break;
101 case 'plyr': ?>
102
103 <!-- BEGINS: RADIO PLAYER CODE -->
104 <div style=" <?php if($player_postiion=="right"){echo "width:100%; overflow:hidden;"; } ?>">
105 <div style="width:200px; <?php if($player_postiion==""){echo "margin:0 auto;";} if($player_postiion=="right"){echo "float:right;";} ?>">
106 <audio class="player" crossorigin playsinline controls>
107
108 <source src="<?php echo $stream_url; ?>" type="audio/mp3" >
109
110 Your browser does not support the audio element.
111 </audio>
112 </div>
113 </div>
114 <style type="text/css">
115 .plyr__control{margin-right:0 !important;}
116
117 </style>
118 <script type="text/javascript">
119 const players<?php echo $id;?> = Plyr.setup('.player', {
120 controls:['play', 'current-time', 'mute', 'volume'],
121 displayDuration: true,
122 });
123 </script>
124 <!-- ENDS: RADIO PLAYER CODE -->
125 <?php
126 break;
127 default:
128 echo "<h2> You must choose a radio player type ! </h2>";
129 }
130 ?>
131 </div>
132 <style type="text/css">
133
134
135 </style>
136 <?php $output=ob_get_clean(); return $output; ?>
137
138 <?php
139 }
140 add_shortcode('radio_player','sc_radio_player_cb');