stream-player.phtml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <div id="content" class="jp-container">
  2. <h1><?php echo _("Live stream") ?></h1>
  3. <a id="popup-link" href="#"><?php echo _("Share") ?></a>
  4. <?php $ids = Application_Model_StreamSetting::getEnabledStreamIds(); ?>
  5. <script>
  6. function setjPlayer(url, type, serverType){
  7. var obj = new Object();
  8. obj[type] = url;
  9. if(serverType == 'shoutcast'){
  10. obj[type] = url + ";stream/1";
  11. }
  12. $("#jquery_jplayer_1").jPlayer("destroy");
  13. $("#jquery_jplayer_1").jPlayer({
  14. ready: function () {
  15. $(this).jPlayer("setMedia", obj).jPlayer("play");
  16. },
  17. ended: function (event) {
  18. $(this).jPlayer("play");
  19. },
  20. swfPath: "/js/jplayer/",
  21. supplied: type,
  22. wmode: "window"
  23. });
  24. }
  25. $(document).ready(function(){
  26. $("#combo-box").change(function(eventObject){
  27. var elem = $("#combo-box option:selected");
  28. setjPlayer(elem.attr("data-url"), elem.attr("data-type"), elem.attr("server-type"));
  29. });
  30. <?php
  31. if (count($ids) > 0){
  32. $id = $ids[0];
  33. $streamData = Application_Model_StreamSetting::getStreamData($id);
  34. $url = "http://".$streamData["${id}_host"].":".$streamData["${id}_port"]."/".$streamData["${id}_mount"];
  35. $type = $streamData["${id}_type"];
  36. $serverType = $streamData["${id}_output"];
  37. if ($type == "ogg")
  38. $type = "oga";
  39. echo "setjPlayer('$url', '$type', '$serverType');";
  40. }
  41. ?>
  42. $("#popup-link").click(function() {
  43. $("#popup-share").show("slow");
  44. $("#popup-share-link").val($("#combo-box option:selected").attr("data-url"));
  45. });
  46. $("#popup-close").click(function() {
  47. $("#popup-share").hide("slow");
  48. });
  49. });
  50. </script>
  51. <div class="jp-logo"><img id="logo-img" onload='resizeToMaxHeight(this, 40);' src="<?php echo $this->logo ?>" /></div>
  52. <div id="popup-share">
  53. <a class="close-round" href="#" id="popup-close"></a>
  54. <input id="popup-share-link" type="text" readonly="readonly"/>
  55. </div>
  56. <div class="jp-stream stream-player-label">
  57. <div class="jp-stream-text"><?php echo _("Select stream:"); ?></div>
  58. <form id="form1" method="post" action="">
  59. <select id="combo-box">
  60. <?php
  61. foreach($ids as $id) {
  62. $streamData = Application_Model_StreamSetting::getStreamData($id);
  63. $url = "http://".$streamData["${id}_host"].":".$streamData["${id}_port"]."/".$streamData["${id}_mount"];
  64. $type = $streamData["${id}_type"];
  65. $serverType = $streamData["${id}_output"];
  66. if ($type == "ogg")
  67. $type = "oga";
  68. $label = "(".$streamData["${id}_host"].") ".$streamData["${id}_description"]." - ".$streamData["${id}_bitrate"]." kbit/s";
  69. echo sprintf("<option class='stream' value='%s' data-url='%s' data-type='%s' server-type='%s'>%s</option>", $id, $url, $type, $serverType, $label);
  70. }
  71. ?>
  72. </select>
  73. </form>
  74. </div>
  75. <div id="jquery_jplayer_1" class="jp-jplayer"></div>
  76. <div id="jp_container_1" class="jp-audio">
  77. <div class="jp-type-single">
  78. <div id="jp_interface_1" class="jp-gui jp-interface">
  79. <ul class="jp-controls">
  80. <li><a title="mute" tabindex="1" class="jp-mute" href="javascript:;"><?php echo _("mute") ?></a></li>
  81. <li><a title="unmute" tabindex="1" class="jp-unmute" href="javascript:;"><?php echo _("unmute") ?></a></li>
  82. </ul>
  83. <div class="jp-volume-bar">
  84. <div class="jp-volume-bar-value"></div>
  85. </div>
  86. </div>
  87. <div id="jp_playlist_1" class="jp-playlist"></div>
  88. </div>
  89. </div>