function startPlayerFAZ(videoJSON,videoId) { var targetDivId = (videoJSON.MEDIATYPE == "video" ? "fazVideo" : "fazAudio") + videoId; videoJSON.MEDIAPARAMS.isAudio = (videoJSON.MEDIATYPE == "audio") var contentId = targetDivId + "_content"; var contentElementId = targetDivId + "_contentElement"; // Unique IDs - videojs req. if (!videoJSON.MEDIAPARAMS.isEmbedded) { var targetDivId0 = targetDivId; var contentId0 = contentId; var contentElementId0 = contentElementId; targetDivId = targetDivId + "_" + new Date().getTime(); contentId = targetDivId + "_content"; contentElementId = targetDivId + "_contentElement"; $("#" + targetDivId0).attr("id", targetDivId); $("#" + contentId0).attr("id", contentId); $("#" + contentElementId0).attr("id", contentElementId); // Embedded - Storytelling } else { if (videoJSON.MEDIAPARAMS.targetDivId === undefined) { videoJSON.MEDIAPARAMS.targetDivId = targetDivId; videoJSON.MEDIAPARAMS.contentId = contentId; videoJSON.MEDIAPARAMS.contentElementId = contentElementId; startEmberPlayer(videoJSON, videoId); return; } else { videoJSON.MEDIAPARAMS.bForceVPlayerAds = false ; // Fullscreen Ads only with Fullscreen gesture $("#" + contentElementId).addClass("vjs-fullscreen"); } } videoJSON.MEDIAPARAMS.playerId = targetDivId; var isMobile = (/ipad|iphone|ipod|android/i.test(navigator.userAgent.toLowerCase())); var playerInvokedByArticle = videoJSON.MEDIAPARAMS.showPlayerInHq; // HD Autotoggle var isDebugging = false; $(function () { try { GTMEvent("videoJSON",videoJSON); // Audio if (videoJSON.MEDIAPARAMS.isAudio) { var audio = videoJSON.ENCODINGS.AUDIO.FILENAME; // Empty on Video var player = videojs(contentElementId, { "controls": true, "autoplay": false, "preload": "none", "poster": videoJSON.STILL.STILL_BIG, "width": videoJSON.MEDIAPARAMS.playerWidth, "height": Math.round(videoJSON.MEDIAPARAMS.playerWidth / (16 / 9)) }).ready(function () { mmoLog("playerFAZ ready"); var vid = this; vid.on('play', function () { if (!vidBegin) { GTMEvent("vidBegin"); mmoLog("playerFAZ begin"); vidBegin = true; } else { GTMEvent("play"); mmoLog("playerFAZ play"); } }); vid.on("pause", function() { GTMEvent("pause"); mmoLog("playerFAZ paused"); if (vid.seeking()) { var sTo = Math.round(vid.duration()-vid.remainingTime()); GTMEvent("scrub", {"time":sTo}); mmoLog("playerFAZ scrub: "+sTo); } }); vid.one("ended", function () { GTMEvent("vidEnd"); mmoLog("playerFAZ ended"); }); vid.on("timeupdate", function() { if (vid.bufferedPercent() == 1 && !vidBuffered) { vidBuffered = true; GTMEvent("bufferEnd"); mmoLog("playerFAZ buffered"); } }); }); player.src(audio); // Video } else { if (typeof bIQTestVPlayerAds == "undefined") bIQTestVPlayerAds = false; isDebugging = bIQTestVPlayerAds; var noAds = false, adBegin = false, adEnd = false; var vidBegin = false, vidBuffered = false, vidEnd = false; var hdSrc = videoJSON.ENCODINGS.HQ.FILENAME; var highSrc = videoJSON.ENCODINGS.HIGH.FILENAME; $("#" + contentElementId).attr("HD", hdSrc); $("#" + contentElementId).attr("nonHD", highSrc); HDtoggle(contentElementId); var player = videojs(contentElementId, { "plugins": { "HD": {} }, "controls": true, "autoplay": false, "preload": "none", "poster": videoJSON.STILL.STILL_BIG, "width": videoJSON.MEDIAPARAMS.playerWidth, "height": Math.round(videoJSON.MEDIAPARAMS.playerWidth / (16 / 9)) }).ready(function () { var vid = this; mmoLog("playerFAZ ready"); GTMEvent("readyVideo"); GTMEvent("bufferBegin"); // preload auto // Text Overlay if ($("#"+contentId).parents(".multimediaBoxContainer").length > 0) { $("#" + contentId + " .VdoPlayerCtrls").appendTo("#" + contentElementId + " .vjs-poster"); $("#" + contentElementId + " .vjs-poster .VdoPlayerCtrls").show(); } else { $("#" + contentId + " .VdoPlayerCtrls").remove(); } $("#" + contentElementId).show(); // Events vid.on('play', function () { $("#" + contentElementId).children("video").show(); if ((noAds || adEnd) && !vidBegin) { GTMEvent("vidBegin"); mmoLog("playerFAZ begin"); vidBegin = true; } else if (noAds || adEnd) { GTMEvent("play"); mmoLog("playerFAZ play"); } }); vid.one("ended", function () { GTMEvent("vidEnd"); mmoLog("playerFAZ end"); }); vid.on("pause", function() { if (noAds || adEnd) { GTMEvent("pause"); mmoLog("playerFAZ pause"); } if (vid.seeking()) { var sTo = Math.round(vid.duration()-vid.remainingTime()); GTMEvent("scrub", {"time":sTo}); mmoLog("playerFAZ scrub: "+sTo); } }); vid.on("timeupdate", function() { if (vid.bufferedPercent() == 1 && !vidBuffered) { vidBuffered = true; GTMEvent("bufferEnd"); mmoLog("playerFAZ buffered"); } }) }); player.src(highSrc); // Ad Pre-rolls if ((typeof oAdvert != "undefined" || videoJSON.MEDIAPARAMS.isEmbedded) && videoJSON.MEDIAPARAMS.bForceVPlayerAds) { var sIQTestVPlayerAds = ""; if (bIQTestVPlayerAds) sIQTestVPlayerAds = "/test&t=test%3Dtablet"; var playerCacheBuster = parseInt(Math.random() * 100000000); var options = { id: contentElementId, locale: "de", adTagUrl: 'http://pubads.g.doubleclick.net/gampad/ads?sz=16x9&iu=/183/iqdfaz/video' + sIQTestVPlayerAds + '&ciu_szs&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=http://www.faz.net&correlator=' + playerCacheBuster + '&cust_params=pos%3Dpre' }; player.one("adsready", function () { mmoLog("playerFAZ ads ready"); GTMEvent("readyAd"); }); player.one("adstart", function () { adBegin = true; mmoLog("playerFAZ ads started"); GTMEvent("adBegin"); }); player.one("adend", function () { adEnd = true; mmoLog("playerFAZ ads done"); GTMEvent("adEnd"); }); player.one("adserror", function () { noAds = true; mmoLog("playerFAZ ads error"); }); player.ima(options); player.ima.requestAds(); } else { noAds = true; mmoLog("playerFAZ no ads"); } } try { // TODO: wegen HDToggle /* trackEvent({id: 13,ci: sci,cn: stle,npb: 0,sqty: iqty,smark: smark}); */ $("#" + contentElementId +" video, #" + contentElementId+" audio").attr("data-gets", videoJSON.MEDIAPARAMS.gets); __GETS.vid(); } catch (ex) { } } catch (e) { mmoLog("playerFAZ error: " + e); } // Utils function mmoLog (txt) { if (isDebugging) { var $node = $("#" + targetDivId).parent().next(); if (!$node.hasClass("mmoLog")) { $node.css({"text-align": "left"}); $node.addClass("mmoLog"); $node.empty(); } var ts = new Date(); var tm = ts.toTimeString().replace(" GMT+", "." + (ms = "000" + ts.getUTCMilliseconds()).substr(ms.length - 3) + " GMT+"); txt = "