'; var jwView = document.createElement('iframe'); jwView.setAttribute('name', 'fp-jw-' + placement); jwView.setAttribute('style', 'width:100%;height:100%;position:absolute;top:0'); jwView.setAttribute('frameborder', 0); jwView.setAttribute('scrolling', 'no'); jwView.setAttribute('marginheight', 0); jwView.setAttribute('marginwidth', 0); jwView.setAttribute('allowfullscreen', true); jwView.setAttribute('srcdoc', html); jwView.setAttribute('src', 'javascript:window.onload=function(){document.write(frameElement.getAttribute("srcdoc"));document.close();}'); placeholder.appendChild(jwView); var playlistURL = 'https://cdn.jwplayer.com/v2/playlists/' + config.playlist; if (config.search) { if (typeof config.search === 'function') { tags = config.search(tags); playlistURL += tags; } else if (tags) { tags = tags.map(function(p) { return p.indexOf(' ') > -1 ? '"' + p +'"' : p; }).join(' '); if (!tags.length) return; var search = encodeURIComponent(tags); playlistURL += '?reason=true&semantic=true&search=' + search; } } jwView.onload = function () { $.getJSON(playlistURL).done(function (body) { var playlist = body.playlist; if (!playlist.length) { fallback('JWPlayer - Playlist: ' + config.playlist + ' is empty: ' + tags); return; } var semanticMatch = false; for (var i = 0; i < playlist.length; i++) { var list = playlist[i]; if (list.reason !== 'S0') { semanticMatch = true; break; } } if (!semanticMatch) { dataLayer.push({ event: 'ApEvent', apEventCategory: 'jwplayer-' + placement, apEventAction: 'semantic-no-match-S0', apEventLabel: 'fr-?' }); } if (config.shuffle) { playlist = shuffle(playlist); } placeholder.style.display = 'block'; var playerInstance = jwView.contentWindow.jwplayer('jwplayer'); playerInstance.setup({playlist: playlist}); playerInstance.on('ready', function () { if (typeof cb === 'function') { cb(playerInstance, playlist, config); } }); playerInstance.on('resize', function(size) { if (!size.height || playerInstance.getFullscreen()) { return; } placeholder.style.height = jwView.contentWindow.document.body.clientHeight + 'px'; }); playerInstance.on('setupError', function () { playerInstance.remove(); fallback('JWPlayer - setupError'); }); }).fail(fallback); }; function fallback(msg) { if (typeof config.fallback === 'function') { config.fallback({id: id, tags: tags}); } else { if (typeof msg === 'string') { var c = document.createComment(msg); placeholder.parentNode.insertBefore(c, placeholder); placeholder.remove(); } else { console.log('JWPlayer - fallback', msg); placeholder.remove(); } } } function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; while (0 !== currentIndex) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } };
Nous utilisons des cookies sur nos sites web. Des informations sur les cookies et sur la manière dont vous pouvez vous opposer à leur utilisation à tout moment ou mettre fin à leur utilisation sont disponibles dans notre Déclaration de protection des données.

Nos sélections