1/* eslint-disable */ 2const loadSgPlayer = function (config) { 3 if (!config) return; 4 config.debug = /(\?|&)debug(=|&|#|$)/.test(window.location.search); 5 config.autoLoad = false; 6 config.autoPlay = true; 7 config.images = { 8 favicon: 'https://player.streamguys.com/cmg/persistent/sgplayer/2-6-12/include/assets/img/favicon.png', 9 fallbackAlbumArt: 'https://player.streamguys.com/cmg/persistent/sgplayer/2-6-12/include/assets/img/fallback.png', 10 infoButton: 'https://player.streamguys.com/cmg/persistent/sgplayer/2-6-12/include/assets/img/info_button.png', 11 amazonButton: 'https://player.streamguys.com/cmg/persistent/sgplayer/2-6-12/include/assets/img/amazon.png', 12 loadingIndicator: 'https://player.streamguys.com/cmg/persistent/sgplayer/2-6-12/include/assets/img/loader.gif' 13 }; 14 config.streams[0].fallbackArt = config.images.fallbackAlbumArt; 15 config.streams[0].metaData.synchFallbackArt.image = config.images.fallbackAlbumArt; 16 17 new SGPlayer({ 18 query: [], 19 activeStreamIndex: 0, 20 mode: "standard", 21 sourceOverride: null, 22 noVideoPreroll: /(\?|&)no-preroll(=|&|#|$)/.test(window.location.search), 23 playerIsMobile: /(iPod|iPhone|iPad)/.test(window.navigator.userAgent) && /AppleWebKit/.test(window.navigator.userAgent), 24 targetspotUid: null, 25 nowPlayingPath: "sgplayer/include/php/nowPlaying.php", 26 metadataProxyPath: "sgplayer/include/php/metadata.php", 27 rssProxyPath: "sgplayer/include/php/rss.php", 28 amazonSearchPath: "sgplayer/include/php/getCover.php", 29 swfFallbackPath: "sgplayer/include/SGPlayerFallback.swf", 30 vjsSwfPath: "sgplayer/include/video-js.swf", 31 config: config 32 }, function (player) { 33 const playerContainer = document.getElementById('persistent-player'); 34 if (!playerContainer) return; 35 const hiddenPlayerComponents = document.querySelectorAll('.pp-show-on-load'); 36 for (let i = 0; i < hiddenPlayerComponents.length; ++i) { 37 hiddenPlayerComponents[i].classList.remove('hidden'); 38 hiddenPlayerComponents[i].classList.remove('pp-show-on-load'); 39 } 40 41 // helper functions 42 let isRetry = false; 43 let playerPaused = false; 44 const modal = document.getElementById('player-retry-modal'); 45 const expandedPlayer = document.getElementById('player'); 46 const hideModal = function () { 47 isRetry = false; 48 expandedPlayer.classList.add('hide_on_preroll'); 49 modal.classList.add('hidden'); 50 const icons = document.querySelectorAll('.player-icons-container'); 51 for (let i = 0; i < icons.length; ++i) { 52 icons[i].classList.remove('ui-icon-retry'); 53 } 54 }; 55 const showModal = function () { 56 isRetry = true; 57 document.body.classList.add('locked'); 58 expandedPlayer.classList.remove('hide_on_preroll'); 59 modal.classList.remove('hidden'); 60 const icons = document.querySelectorAll('.player-icons-container'); 61 for (let i = 0; i < icons.length; ++i) { 62 icons[i].classList.add('ui-icon-retry'); 63 } 64 }; 65 const addLoading = function () { 66 const icons = document.querySelectorAll('.player-icons-container'); 67 for (let i = 0; i < icons.length; ++i) { 68 icons[i].classList.remove('ui-icon-play'); 69 icons[i].classList.remove('ui-icon-pause'); 70 icons[i].classList.remove('ui-icon-retry'); 71 icons[i].classList.add('loading'); 72 } 73 const loadingIcons = document.querySelectorAll('.player-loading-icon'); 74 for (let i = 0; i < loadingIcons.length; ++i) { 75 loadingIcons[i].classList.remove('hidden'); 76 } 77 }; 78 const removeLoading = function () { 79 const icons = document.querySelectorAll('.player-icons-container'); 80 for (let i = 0; i < icons.length; ++i) { 81 icons[i].classList.remove('loading'); 82 } 83 const loadingIcons = document.querySelectorAll('.player-loading-icon'); 84 for (let i = 0; i < loadingIcons.length; ++i) { 85 loadingIcons[i].classList.add('hidden'); 86 } 87 }; 88 const showPause = function () { 89 const icons = document.querySelectorAll('.player-icons-container'); 90 for (let i = 0; i < icons.length; ++i) { 91 icons[i].classList.remove('ui-icon-play'); 92 icons[i].classList.add('ui-icon-pause'); 93 } 94 }; 95 const showPlay = function () { 96 const icons = document.querySelectorAll('.player-icons-container'); 97 for (let i = 0; i < icons.length; ++i) { 98 icons[i].classList.remove('ui-icon-pause'); 99 icons[i].classList.add('ui-icon-play'); 100 } 101 }; 102 const expandPlayer = function () { 103 window.fireEvent('ExpandPlayer'); 104 }; 105 106 // stream event listeners 107 player.on(STREAMGUYS.EVENTS.MEDIA.PLAY, function () { 108 addLoading(); 109 expandPlayer(); 110 }); 111 player.on(STREAMGUYS.EVENTS.MEDIA.PAUSE, function () { 112 showPlay(); 113 playerPaused = true; 114 }); 115 player.on(STREAMGUYS.EVENTS.MEDIA.WAITING, addLoading); 116 player.on(STREAMGUYS.EVENTS.MEDIA.PLAYING, function () { 117 document.body.classList.remove('locked'); 118 hideModal(); 119 showPause(); 120 removeLoading(); 121 }); 122 player.on(STREAMGUYS.EVENTS.MEDIA.EMPTIED, function () { 123 showPlay(); 124 removeLoading(); 125 }); 126 player.on(STREAMGUYS.EVENTS.MEDIA.ERROR, function () { 127 showModal(); 128 removeLoading(); 129 }); 130 player.on(STREAMGUYS.EVENTS.MEDIA.SUSPEND, function () { 131 player.pause(); 132 showModal(); 133 removeLoading(); 134 }); 135 136 // preroll event listeners 137 if (player.plugins.sgVideo.sgVast.ads === false) player.noVideoPreroll = true; 138 player.on(STREAMGUYS.EVENTS.ADS.VIDEO.PREROLL.LOAD, function () { 139 playerContainer.setAttribute('preroll', true); 140 addLoading(); 141 expandPlayer(); 142 }); 143 player.on(STREAMGUYS.EVENTS.ADS.VIDEO.PREROLL.LOADED, function () { 144 document.body.classList.add('locked'); 145 showPause(); 146 removeLoading(); 147 }); 148 player.on(STREAMGUYS.EVENTS.ADS.VIDEO.PREROLL.PLAY, function () { 149 document.body.classList.add('locked'); 150 expandPlayer(); 151 showPause(); 152 }); 153 player.on(STREAMGUYS.EVENTS.ADS.VIDEO.PREROLL.PLAYING, function () { 154 hideModal(); 155 showPause(); 156 }); 157 player.on(STREAMGUYS.EVENTS.ADS.VIDEO.PREROLL.PAUSE, showPlay); 158 const createAdContainer = function () { 159 if (document.getElementById('bannerAd') || document.body.classList.contains('locked')) return; 160 const playerExpandedContainer = document.getElementById('playerExpandedAd'); 161 if (!playerExpandedContainer) return;
162 try { 163 playerExpandedContainer.innerHTML = '<div id="bannerAd" class="arcad display-label force-label"></div>'; 164 player.plugins.sgAdswizz.synchAdswizzBanner(); 165 } catch (_) { 166 console.warn('failed to load ad'); 167 } 168 }; 169 const closePreroll = function () { 170 if (!playerContainer.hasAttribute('preroll')) return; 171 playerContainer.removeAttribute('preroll'); 172 document.body.classList.remove('locked'); 173 addLoading(); 174 createAdContainer(); 175 }; 176 player.on(STREAMGUYS.EVENTS.ADS.VAST.EMPTY, closePreroll); 177 player.on(STREAMGUYS.EVENTS.ADS.VIDEO.PREROLL.ENDED, closePreroll); 178 player.on(STREAMGUYS.EVENTS.ADS.VIDEO.PREROLL.ERROR, function () { 179 showModal(); 180 removeLoading(); 181 }); 182 window.addEventListener('CreateAdContainer', createAdContainer); 183 184 // play/pause/retry event listener 185 const togglePlayer = function () { 186 if (playerPaused) { 187 player.play(); 188 playerPaused = false; 189 return; 190 } 191 if (!player.isStarted()) return player.start(); 192 if (isRetry) { 193 addLoading(); 194 playerContainer.setAttribute('expanded', true); 195 if (playerContainer.hasAttribute('preroll')) { 196 if (!player.videoPrerollElement) player.plugins.sgVideo.loadVideoPreroll(); 197 else player.videoPrerollElement.play(); 198 } 199 else { 200 createAdContainer(); 201 player.play(); 202 } 203 return; 204 } 205 const prerollVideo = player.videoPrerollElement; 206 if (prerollVideo) { 207 if (prerollVideo.paused()) prerollVideo.play(); 208 else prerollVideo.pause(); 209 } 210 else { 211 if (player.isPlaying()) player.pause(); 212 else player.play(); 213 } 214 }; 215 window.addEventListener('TogglePlayer', togglePlayer); 216 217 // check for autoplay 218 if (/(\?|&)expand-player(=|&|#|$)/.test(window.location.search)) expandPlayer(); 219 }); 220}; 221 222const getSgConfig = function () { 223 if (!window.sgStationId) return Promise.resolve(); 224 return new Promise(function (resolve) { 225 const request = new XMLHttpRequest(); 226 request.open('GET', 'https://player.streamguys.com/cmg/' + window.sgStationId + '/sgplayer/config.json'); 227 request.onreadystatechange = function () { 228 if (request.readyState !== 4) return; 229 if (request.status >= 200 && request.status < 300) { 230 resolve(JSON.parse(request.responseText)); 231 } else { 232 console.error(request.statusText); 233 resolve(); 234 } 235 }; 236 request.send(); 237 }); 238}; 239 240if (!window.StreamGuysConfigLoaded) { 241 getSgConfig().then(loadSgPlayer); 242 window.StreamGuysConfigLoaded = true; 243} 244 245/* eslint-enable */
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.