Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local _ENV = require("castl.runtime");
- local livestreamPlayerCallback,onYouTubePlayerReady,registerPlayer,DefaultVideo,getPlayerByType,players,theater;
- getPlayerByType = (function (this, type)
- do return players[type]; end
- end);
- registerPlayer = (function (this, type, object)
- object.prototype = _new(DefaultVideo);
- object.prototype.type = type;
- object.prototype.getType = (function (this)
- do return this.type; end
- end);
- players[type] = object;
- end);
- onYouTubePlayerReady = (function (this, playerId)
- local type,player;
- player = theater:getPlayer();
- type = ((function() if _bool(player) then return player:getType(); else return player; end end)());
- if _bool(((function() if _bool(player) then return (((_eq(type,"youtube")) and (_eq(type,"youtube")) or (_eq(type,"youtubelive"))) and ((_eq(type,"youtube")) and (_eq(type,"youtube")) or (_eq(type,"youtubelive"))) or (_eq(type,"kissyoutube"))); else return player; end end)())) then
- player:onReady();
- end
- end);
- livestreamPlayerCallback = (function (this, event, data)
- local player;
- if (_eq(event,"ready")) then
- player = theater:getPlayer();
- if _bool(((function() if _bool(player) then return (_eq(player:getType(),"livestream")); else return player; end end)())) then
- player:onReady();
- end
- end
- end);
- if (_eq(window.swfobject,undefined)) then
- window.swfobject = null;
- end
- window.open = (function (this)
- do return null; end
- end);
- theater = _obj({
- ["VERSION"] = "1.5.0-YukiTheater",
- ["playerContainer"] = null,
- ["playerContent"] = null,
- ["hdPlayback"] = false,
- ["player"] = null,
- ["volume"] = 25,
- ["syncMaxDiff"] = 10,
- ["getPlayerContainer"] = (function (this)
- if (_eq(this.playerContainer,null)) then
- this.playerContainer = (_bool(document:getElementById("player-container")) and document:getElementById("player-container") or document:createElement("div"));
- end
- do return this.playerContainer; end
- end),
- ["getPlayerContent"] = (function (this)
- if (_eq(this.playerContent,null)) then
- this.playerContent = (_bool(document:getElementById("content")) and document:getElementById("content") or document:createElement("div"));
- end
- do return this.playerContent; end
- end),
- ["resetPlayer"] = (function (this)
- if _bool(this.player) then
- this.player:onRemove();
- (function () local _r = false; local _g, _s = this["_g" .. "player"], this["_s" .. "player"]; this["_g" .. "player"], this["_s" .. "player"] = nil, nil; _r = _g ~= nil or _s ~= nil;
- local _v = this.player; this.player = nil; return _r or _v ~= nil; end)();
- end
- this:getPlayerContainer().innerHTML = "<div id='player'></div>";
- end),
- ["enablePlayer"] = (function (this)
- local content,player;
- player = this:getPlayerContainer();
- player.style.display = "block";
- content = this:getPlayerContent();
- content.style.display = "none";
- end),
- ["disablePlayer"] = (function (this)
- local content,player;
- player = this:getPlayerContainer();
- player.style.display = "none";
- this:resetPlayer();
- content = this:getPlayerContent();
- content.style.display = "block";
- end),
- ["getPlayer"] = (function (this)
- do return this.player; end
- end),
- ["loadVideo"] = (function (this, type, data, startTime)
- local playerObject,player;
- if ((_eq(type,null)) and (_eq(type,null)) or (_eq(data,null))) then
- do return end
- end
- if (_eq(type,"")) then
- this:disablePlayer();
- do return end
- end
- startTime = Math:max(0,startTime);
- player = this:getPlayer();
- if ((_eq(player,null)) and (_eq(player,null)) or (not _eq(player:getType(),type))) then
- this:resetPlayer();
- this:enablePlayer();
- playerObject = getPlayerByType(_ENV,type);
- if (not _eq(playerObject,null)) then
- this.player = _new(playerObject);
- else
- this:getPlayerContainer().innerText = "ERROR: Video type not yet implemented.";
- this:getPlayerContainer().style.color = "red";
- do return end
- end
- end
- ga(_ENV,"send","event","services","load",type);
- this.player:setVolume((function() if (not _eq(this.volume,null)) then return this.volume; else return 25; end end)());
- this.player:setStartTime((_bool(startTime) and startTime or 0));
- this.player:setVideo(data);
- console:log(((_addStr1(((_addStr1("Initializing Player: ",type)) .. " at "),startTime)) .. " seconds..."));
- end),
- ["setVolume"] = (function (this, volume)
- this.volume = volume;
- if (not _eq(this.player,null)) then
- this.player:setVolume(volume);
- end
- end),
- ["seek"] = (function (this, seconds)
- local player;
- player = this:getPlayer();
- if _bool(player) then
- player:seek(seconds);
- end
- end),
- ["setForceVideoRes"] = (function (this, bool)
- if (not _eq(this.forceVideoRes,bool)) then
- this.forceVideoRes = bool;
- console:log(((_addStr1("forceVideoRes set to ",bool)) .. "!"));
- end
- end),
- ["isForceVideoRes"] = (function (this)
- do return this.forceVideoRes; end
- end),
- ["sync"] = (function (this, time)
- local current;
- if (_eq(time,null)) then
- do return end
- end
- if (not _eq(this.player,null)) then
- current = this.player:getCurrentTime();
- if ((function() if (not _eq(current,null)) then return (_gt(Math:abs((time - current)),this.syncMaxDiff)); else return (not _eq(current,null)); end end)()) then
- this.player:setStartTime(time);
- console:log(((_addStr1("Attempting to sync player to ",time)) .. " seconds..."));
- end
- end
- end),
- ["toggleControls"] = (function (this, enabled)
- if (not _eq(this.player,null)) then
- this.player:toggleControls(enabled);
- end
- end),
- ["enableCC"] = (function (this)
- this.closedCaptions = true;
- end),
- ["isCCEnabled"] = (function (this)
- do return this.closedCaptions; end
- end)
- });
- players = _arr({},0);
- DefaultVideo = (function (this)
- end);
- DefaultVideo.prototype = _obj({
- ["player"] = null,
- ["lastVideoId"] = null,
- ["videoId"] = null,
- ["lastVolume"] = null,
- ["volume"] = 0.123,
- ["currentTime"] = 0,
- ["getCurrentTime"] = (function (this)
- do return null; end
- end),
- ["lastStartTime"] = 0,
- ["startTime"] = 0,
- ["setVolume"] = (function (this, volume)
- end),
- ["setStartTime"] = (function (this, seconds)
- end),
- ["seek"] = (function (this, seconds)
- end),
- ["onRemove"] = (function (this)
- end),
- ["toggleControls"] = (function (this)
- end)
- });
- (function (this)
- local Hitbox,HitboxLive,Dailymotion,KissYT,Kiss,YukiTheaterRTMP,UstreamLiveVideo,HtmlVideo,UrlVideo,TwitchStreamVideo,TwitchVideo,VimeoVideo,YouTubeLiveVideo,YouTubeVideo;
- YouTubeVideo = (function (this)
- local url,attributes,params;
- params = _obj({
- ["allowScriptAccess"] = "always",
- ["bgcolor"] = "#000000",
- ["wmode"] = "opaque"
- });
- attributes = _obj({
- ["id"] = "player"
- });
- url = "https://www.youtube.com/get_player?enablejsapi=1&modestbranding=1&autohide=1&controls=1&autoplay=1&iv_load_policy=3";
- if _bool(theater:isCCEnabled()) then
- url = (_addStr2(url,"&cc_load_policy=1"));
- url = (_addStr2(url,"&yt:cc=on"));
- end
- swfobject:embedSWF(url,"player","100%","100%","9",null,null,params,attributes);
- this.setVideo = (function (this, id)
- this.lastStartTime = null;
- this.lastVideoId = null;
- this.videoId = id;
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = volume;
- end);
- this.setStartTime = (function (this, seconds)
- this.lastStartTime = null;
- this.startTime = seconds;
- end);
- this.seek = (function (this, seconds)
- if (not _eq(this.player,null)) then
- this.player:seekTo(seconds,true);
- if (not _eq(this.player:getPlayerState(),1)) then
- this.player:playVideo();
- end
- end
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.getCurrentTime = (function (this)
- if (not _eq(this.player,null)) then
- do return this.player:getCurrentTime(); end
- end
- end);
- this.canChangeTime = (function (this)
- if (not _eq(this.player,null)) then
- do return ((function() if (not _eq(this.player:getVideoBytesTotal(),-1)) then return (not _eq(this.player:getPlayerState(),3)); else return (not _eq(this.player:getVideoBytesTotal(),-1)); end end)()); end
- end
- end);
- this.think = (function (this)
- if (not _eq(this.player,null)) then
- if _bool(theater:isForceVideoRes()) then
- if (not _eq(this.lastWindowHeight,window.innerHeight)) then
- if ((function() if (_le(window.innerHeight,1536)) then return (_gt(window.innerHeight,1440)); else return (_le(window.innerHeight,1536)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1440)) then return (_gt(window.innerHeight,1080)); else return (_le(window.innerHeight,1440)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1080)) then return (_gt(window.innerHeight,720)); else return (_le(window.innerHeight,1080)); end end)()) then
- this.ytforceres = "hd1080";
- end
- if ((function() if (_le(window.innerHeight,720)) then return (_gt(window.innerHeight,480)); else return (_le(window.innerHeight,720)); end end)()) then
- this.ytforceres = "hd720";
- end
- if ((function() if (_le(window.innerHeight,480)) then return (_gt(window.innerHeight,360)); else return (_le(window.innerHeight,480)); end end)()) then
- this.ytforceres = "large";
- end
- if ((function() if (_le(window.innerHeight,360)) then return (_gt(window.innerHeight,240)); else return (_le(window.innerHeight,360)); end end)()) then
- this.ytforceres = "medium";
- end
- if (_le(window.innerHeight,240)) then
- this.ytforceres = "small";
- end
- this.player:setPlaybackQuality(this.ytforceres);
- console:log((_addStr1("Forcing Quality Change to ",this.ytforceres)));
- this.lastWindowHeight = window.innerHeight;
- end
- end
- if (not _eq(this.videoId,this.lastVideoId)) then
- this.player:loadVideoById(this.videoId,this.startTime,(function() if _bool(this.ytforceres) then return this.ytforceres; else return "default"; end end)());
- this.lastVideoId = this.videoId;
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.player:getPlayerState(),-1)) then
- if (not _eq(this.startTime,this.lastStartTime)) then
- this:seek(this.startTime);
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.volume,this.lastVolume)) then
- this.player:setVolume(this.volume);
- this.lastVolume = this.volume;
- end
- end
- end
- end);
- this.onReady = (function (this)
- this.player = document:getElementById("player");
- if _bool(theater:isForceVideoRes()) then
- if ((function() if (_le(window.innerHeight,1536)) then return (_gt(window.innerHeight,1440)); else return (_le(window.innerHeight,1536)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1440)) then return (_gt(window.innerHeight,1080)); else return (_le(window.innerHeight,1440)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1080)) then return (_gt(window.innerHeight,720)); else return (_le(window.innerHeight,1080)); end end)()) then
- this.ytforceres = "hd1080";
- end
- if ((function() if (_le(window.innerHeight,720)) then return (_gt(window.innerHeight,480)); else return (_le(window.innerHeight,720)); end end)()) then
- this.ytforceres = "hd720";
- end
- if ((function() if (_le(window.innerHeight,480)) then return (_gt(window.innerHeight,360)); else return (_le(window.innerHeight,480)); end end)()) then
- this.ytforceres = "large";
- end
- if ((function() if (_le(window.innerHeight,360)) then return (_gt(window.innerHeight,240)); else return (_le(window.innerHeight,360)); end end)()) then
- this.ytforceres = "medium";
- end
- if (_le(window.innerHeight,240)) then
- this.ytforceres = "small";
- end
- this.player:setPlaybackQuality(this.ytforceres);
- console:log((_addStr1("Forcing Quality Change to ",this.ytforceres)));
- end
- this.interval = setInterval(_ENV,this.think:bind(this),100);
- end);
- end);
- registerPlayer(_ENV,"youtube",YouTubeVideo);
- YouTubeLiveVideo = (function (this)
- local player;
- this.setVideo = (function (this, id)
- this.lastStartTime = null;
- this.lastVideoId = null;
- this.videoId = id;
- if _bool(player) then
- do return end
- end
- player = _new(YT.Player,"player",_obj({
- ["height"] = "100%",
- ["width"] = "100%",
- ["videoId"] = id,
- ["playerVars"] = _obj({
- ["autoplay"] = 1,
- ["controls"] = 1,
- ["autohide"] = 1,
- ["iv_load_policy"] = 3,
- ["cc_load_policy"] = (function() if _bool(theater.closedCaptions) then return 1; else return 0; end end)()
- }),
- ["events"] = _obj({
- ["onReady"] = onYouTubePlayerReady
- })
- }));
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = volume;
- end);
- this.setStartTime = (function (this, seconds)
- this.lastStartTime = null;
- this.startTime = seconds;
- end);
- this.seek = (function (this, seconds)
- if (this.player ~= null) then
- this.player:seekTo(seconds,true);
- if (not _eq(this.player:getPlayerState(),1)) then
- this.player:playVideo();
- end
- end
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.getCurrentTime = (function (this)
- if (this.player ~= null) then
- do return this.player:getCurrentTime(); end
- end
- end);
- this.canChangeTime = (function (this)
- if (this.player ~= null) then
- do return ((function() if (not _eq(this.player:getVideoBytesTotal(),-1)) then return (not _eq(this.player:getPlayerState(),3)); else return (not _eq(this.player:getVideoBytesTotal(),-1)); end end)()); end
- end
- end);
- this.think = (function (this)
- if (this.player ~= null) then
- if _bool(theater:isForceVideoRes()) then
- if (not _eq(this.lastWindowHeight,window.innerHeight)) then
- if ((function() if (_le(window.innerHeight,1536)) then return (_gt(window.innerHeight,1440)); else return (_le(window.innerHeight,1536)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1440)) then return (_gt(window.innerHeight,1080)); else return (_le(window.innerHeight,1440)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1080)) then return (_gt(window.innerHeight,720)); else return (_le(window.innerHeight,1080)); end end)()) then
- this.ytforceres = "hd1080";
- end
- if ((function() if (_le(window.innerHeight,720)) then return (_gt(window.innerHeight,480)); else return (_le(window.innerHeight,720)); end end)()) then
- this.ytforceres = "hd720";
- end
- if ((function() if (_le(window.innerHeight,480)) then return (_gt(window.innerHeight,360)); else return (_le(window.innerHeight,480)); end end)()) then
- this.ytforceres = "large";
- end
- if ((function() if (_le(window.innerHeight,360)) then return (_gt(window.innerHeight,240)); else return (_le(window.innerHeight,360)); end end)()) then
- this.ytforceres = "medium";
- end
- if (_le(window.innerHeight,240)) then
- this.ytforceres = "small";
- end
- this.player:setPlaybackQuality(this.ytforceres);
- console:log((_addStr1("Forcing Quality Change to ",this.ytforceres)));
- this.lastWindowHeight = window.innerHeight;
- end
- end
- if (not _eq(this.videoId,this.lastVideoId)) then
- this.player:loadVideoById(this.videoId,this.startTime,(function() if _bool(this.ytforceres) then return this.ytforceres; else return "default"; end end)());
- this.lastVideoId = this.videoId;
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.player:getPlayerState(),-1)) then
- if (not _eq(this.startTime,this.lastStartTime)) then
- this:seek(this.startTime);
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.volume,this.lastVolume)) then
- this.player:setVolume(this.volume);
- this.lastVolume = this.volume;
- end
- end
- end
- end);
- this.onReady = (function (this)
- this.player = player;
- if _bool(theater:isForceVideoRes()) then
- if ((function() if (_le(window.innerHeight,1536)) then return (_gt(window.innerHeight,1440)); else return (_le(window.innerHeight,1536)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1440)) then return (_gt(window.innerHeight,1080)); else return (_le(window.innerHeight,1440)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1080)) then return (_gt(window.innerHeight,720)); else return (_le(window.innerHeight,1080)); end end)()) then
- this.ytforceres = "hd1080";
- end
- if ((function() if (_le(window.innerHeight,720)) then return (_gt(window.innerHeight,480)); else return (_le(window.innerHeight,720)); end end)()) then
- this.ytforceres = "hd720";
- end
- if ((function() if (_le(window.innerHeight,480)) then return (_gt(window.innerHeight,360)); else return (_le(window.innerHeight,480)); end end)()) then
- this.ytforceres = "large";
- end
- if ((function() if (_le(window.innerHeight,360)) then return (_gt(window.innerHeight,240)); else return (_le(window.innerHeight,360)); end end)()) then
- this.ytforceres = "medium";
- end
- if (_le(window.innerHeight,240)) then
- this.ytforceres = "small";
- end
- this.player:setPlaybackQuality(this.ytforceres);
- console:log((_addStr1("Forcing Quality Change to ",this.ytforceres)));
- end
- this.interval = setInterval(_ENV,this.think:bind(this),100);
- end);
- end);
- registerPlayer(_ENV,"youtubelive",YouTubeLiveVideo);
- VimeoVideo = (function (this)
- local self;
- self = this;
- this.froogaloop = null;
- this.setVideo = (function (this, id)
- local frame,url,elem;
- this.videoId = id;
- elem = document:getElementById("player1");
- if _bool(elem) then
- Sf(_ENV,elem):removeEvent("ready");
- this.froogaloop = null;
- elem.parentNode:removeChild(elem);
- end
- url = ((_addStr1("https://player.vimeo.com/video/",id)) .. "?api=1&player_id=player1");
- frame = document:createElement("iframe");
- frame:setAttribute("id","player1");
- frame:setAttribute("src",url);
- frame:setAttribute("width","100%");
- frame:setAttribute("height","100%");
- frame:setAttribute("frameborder","0");
- document:getElementById("player"):appendChild(frame);
- Sf(_ENV,frame):addEvent("ready",this.onReady);
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = (volume / 100);
- end);
- this.setStartTime = (function (this, seconds)
- this.lastStartTime = null;
- this.startTime = Math:max(1,seconds);
- end);
- this.seek = (function (this, seconds)
- if ((function() if (not _eq(this.froogaloop,null)) then return (_gt(seconds,1)); else return (not _eq(this.froogaloop,null)); end end)()) then
- this.froogaloop:api("pause");
- this.froogaloop:api("seekTo",seconds);
- this.froogaloop:api("play");
- end
- end);
- this.onRemove = (function (this)
- this.froogaloop = null;
- clearInterval(_ENV,this.interval);
- end);
- this.getCurrentTime = (function (this)
- if (not _eq(this.froogaloop,null)) then
- do return (_bool(self.currentTime) and self.currentTime or 1); end
- end
- end);
- this.think = (function (this)
- if (not _eq(this.froogaloop,null)) then
- if (not _eq(this.volume,this.lastVolume)) then
- this.froogaloop:api("setVolume",this.volume);
- this.lastVolume = this.volume;
- end
- if (not _eq(this.startTime,this.lastStartTime)) then
- this:seek(this.startTime);
- this.lastStartTime = this.startTime;
- end
- this.froogaloop:api("getVolume",(function (this, v)
- self.volume = parseFloat(_ENV,v);
- end));
- this.froogaloop:api("getCurrentTime",(function (this, v)
- self.currentTime = parseFloat(_ENV,v);
- end));
- end
- end);
- this.onReady = (function (this, player__id)
- self.lastStartTime = null;
- self.froogaloop = Sf(_ENV,player__id);
- self.froogaloop:api("play");
- setTimeout(_ENV,(function (this)
- self.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end),2500);
- end);
- end);
- registerPlayer(_ENV,"vimeo",VimeoVideo);
- TwitchVideo = (function (this)
- local self;
- self = this;
- this.videoInfo = _obj({});
- this.embed = (function (this)
- local params,swfurl,videoType,id,flashvars;
- if not _bool(this.videoInfo.channel) then
- do return end
- end
- if not _bool(this.videoInfo["archive_id"]) then
- do return end
- end
- flashvars = _obj({
- ["hostname"] = "www.twitch.tv",
- ["channel"] = this.videoInfo.channel,
- ["auto_play"] = true,
- ["start_volume"] = (_bool(this.videoInfo.volume) and this.videoInfo.volume or theater.volume),
- ["initial_time"] = (_bool(this.videoInfo["initial_time"]) and this.videoInfo["initial_time"] or 0)
- });
- id = this.videoInfo["archive_id"]:slice(1);
- videoType = this.videoInfo["archive_id"]:substr(0,1);
- flashvars.videoId = (_add(videoType,id));
- if (_eq(videoType,"c")) then
- flashvars["chapter_id"] = id;
- else
- flashvars["archive_id"] = id;
- end
- swfurl = "https://www.twitch.tv/swflibs/TwitchPlayer.swf";
- params = _obj({
- ["allowFullScreen"] = "true",
- ["allowNetworking"] = "all",
- ["allowScriptAccess"] = "always",
- ["movie"] = swfurl,
- ["wmode"] = "opaque",
- ["bgcolor"] = "#000000"
- });
- swfobject:embedSWF(swfurl,"player","100%","104%","9.0.0",false,flashvars,params);
- end);
- this.setVideo = (function (this, id)
- local interval,i,info;
- this.lastVideoId = null;
- this.videoId = id;
- info = id:split(",");
- this.videoInfo.channel = info[0];
- this.videoInfo["archive_id"] = info[1];
- if (_eq(this.player,null)) then
- this.lastVideoId = this.videoId;
- this:embed();
- i = 0;
- interval = setInterval(_ENV,(function (this)
- local el;
- el = document:getElementById("player");
- if _bool(el.mute) then
- clearInterval(_ENV,interval);
- self:onReady();
- end
- i = _inc(i);
- if (_gt(i,100)) then
- console:log("Error waiting for player to load");
- clearInterval(_ENV,interval);
- end
- end),33);
- end
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = volume;
- this.videoInfo.volume = volume;
- end);
- this.setStartTime = (function (this, seconds)
- this.lastStartTime = null;
- this.startTime = seconds;
- this.videoInfo["initial_time"] = seconds;
- end);
- this.seek = (function (this, seconds)
- this:setStartTime(seconds);
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.think = (function (this)
- if _bool(this.player) then
- if (not _eq(this.videoId,this.lastVideoId)) then
- this:embed();
- this.lastVideoId = this.videoId;
- end
- if (not _eq(this.startTime,this.lastStartTime)) then
- this:embed();
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.volume,this.lastVolume)) then
- this.lastVolume = this.volume;
- end
- end
- end);
- this.onReady = (function (this)
- this.player = document:getElementById("player");
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- this.toggleControls = (function (this, enabled)
- this.player.height = (function() if _bool(enabled) then return "100%"; else return "104%"; end end)();
- end);
- end);
- registerPlayer(_ENV,"twitch",TwitchVideo);
- TwitchStreamVideo = (function (this)
- local self;
- self = this;
- this.embed = (function (this)
- local params,swfurl,flashvars;
- flashvars = _obj({
- ["hostname"] = "www.twitch.tv",
- ["hide_chat"] = true,
- ["channel"] = this.videoId,
- ["embed"] = 0,
- ["auto_play"] = true,
- ["start_volume"] = (_bool((_bool(this.volume) and this.volume or theater.volume)) and (_bool(this.volume) and this.volume or theater.volume) or 25)
- });
- swfurl = "https://www.twitch.tv/swflibs/TwitchPlayer.swf";
- params = _obj({
- ["allowFullScreen"] = "true",
- ["allowNetworking"] = "all",
- ["allowScriptAccess"] = "always",
- ["movie"] = swfurl,
- ["wmode"] = "opaque",
- ["bgcolor"] = "#000000"
- });
- swfobject:embedSWF(swfurl,"player","100%","104%","9.0.0",false,flashvars,params);
- end);
- this.setVideo = (function (this, id)
- local interval,i;
- this.lastVideoId = null;
- this.videoId = id;
- if (_eq(this.player,null)) then
- this.lastVideoId = this.videoId;
- this:embed();
- i = 0;
- interval = setInterval(_ENV,(function (this)
- local el;
- el = document:getElementById("player");
- if _bool(el.mute) then
- clearInterval(_ENV,interval);
- self:onReady();
- end
- i = _inc(i);
- if (_gt(i,100)) then
- console:log("Error waiting for player to load");
- clearInterval(_ENV,interval);
- end
- end),33);
- end
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = volume;
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.think = (function (this)
- if _bool(this.player) then
- if (not _eq(this.videoId,this.lastVideoId)) then
- this:embed();
- this.lastVideoId = this.videoId;
- end
- if (not _eq(this.volume,this.lastVolume)) then
- this.lastVolume = this.volume;
- end
- end
- end);
- this.onReady = (function (this)
- this.player = document:getElementById("player");
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- this.toggleControls = (function (this, enabled)
- this.player.height = (function() if _bool(enabled) then return "100%"; else return "104%"; end end)();
- end);
- end);
- registerPlayer(_ENV,"twitchstream",TwitchStreamVideo);
- UrlVideo = (function (this)
- local self;
- self = this;
- this.embed = (function (this)
- local frame,elem;
- elem = document:getElementById("player1");
- if _bool(elem) then
- elem.parentNode:removeChild(elem);
- end
- frame = document:createElement("iframe");
- frame:setAttribute("id","player1");
- frame:setAttribute("src",this.videoId);
- frame:setAttribute("width","100%");
- frame:setAttribute("height","100%");
- frame:setAttribute("frameborder","0");
- document:getElementById("player"):appendChild(frame);
- end);
- this.setVideo = (function (this, id)
- local interval,i;
- this.lastVideoId = null;
- this.videoId = id;
- if (_eq(this.player,null)) then
- this.lastVideoId = this.videoId;
- this:embed();
- i = 0;
- interval = setInterval(_ENV,(function (this)
- local el;
- el = document:getElementById("player");
- if _bool(el) then
- clearInterval(_ENV,interval);
- self:onReady();
- end
- i = _inc(i);
- if (_gt(i,100)) then
- console:log("Error waiting for player to load");
- clearInterval(_ENV,interval);
- end
- end),33);
- end
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.think = (function (this)
- if _bool(this.player) then
- if (not _eq(this.videoId,this.lastVideoId)) then
- this:embed();
- this.lastVideoId = this.videoId;
- end
- end
- end);
- this.onReady = (function (this)
- this.player = document:getElementById("player");
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- end);
- registerPlayer(_ENV,"url",UrlVideo);
- HtmlVideo = (function (this)
- this.embed = (function (this)
- local content,elem;
- elem = document:getElementById("player1");
- if _bool(elem) then
- elem.parentNode:removeChild(elem);
- end
- content = document:createElement("div");
- content:setAttribute("id","player1");
- content.style.width = "100%";
- content.style.height = "100%";
- content.innerHTML = this.videoId;
- document:getElementById("player"):appendChild(content);
- end);
- this.setVideo = (function (this, id)
- this.lastVideoId = null;
- this.videoId = id;
- this:embed();
- end);
- end);
- registerPlayer(_ENV,"html",HtmlVideo);
- UstreamLiveVideo = (function (this)
- local self,viewer,player__container,pre__player;
- pre__player = document:createElement("iframe");
- pre__player.src = "https://www.ustream.tv/embed/1?controls=false";
- pre__player.id = "player";
- pre__player.width = "100%";
- pre__player.height = "100%";
- player__container = document:getElementById("player").parentNode;
- player__container:removeChild(document:getElementById("player"));
- player__container:appendChild(pre__player);
- viewer = UstreamEmbed(_ENV,"player");
- this.setVideo = (function (this, id)
- this.lastVideoId = null;
- this.videoId = id;
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = volume;
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.think = (function (this)
- local self;
- if (not _eq(this.player,null)) then
- if (not _eq(this.videoId,this.lastVideoId)) then
- this.player:callMethod("load","channel",this.videoId);
- self = this;
- setTimeout(_ENV,(function (this)
- self.player:callMethod("play");
- end),3000);
- setTimeout(_ENV,(function (this)
- if _bool(theater:isForceVideoRes()) then
- if ((function() if (_le(window.innerHeight,1536)) then return (_gt(window.innerHeight,1440)); else return (_le(window.innerHeight,1536)); end end)()) then
- this.player:callMethod("quality",16);
- end
- if ((function() if (_le(window.innerHeight,1440)) then return (_gt(window.innerHeight,1080)); else return (_le(window.innerHeight,1440)); end end)()) then
- this.player:callMethod("quality",16);
- end
- if ((function() if (_le(window.innerHeight,1080)) then return (_gt(window.innerHeight,720)); else return (_le(window.innerHeight,1080)); end end)()) then
- this.player:callMethod("quality",16);
- end
- if ((function() if (_le(window.innerHeight,720)) then return (_gt(window.innerHeight,480)); else return (_le(window.innerHeight,720)); end end)()) then
- this.player:callMethod("quality",16);
- end
- if ((function() if (_le(window.innerHeight,480)) then return (_gt(window.innerHeight,360)); else return (_le(window.innerHeight,480)); end end)()) then
- this.player:callMethod("quality",2);
- end
- if ((function() if (_le(window.innerHeight,360)) then return (_gt(window.innerHeight,240)); else return (_le(window.innerHeight,360)); end end)()) then
- this.player:callMethod("quality",1);
- end
- if (_le(window.innerHeight,240)) then
- this.player:callMethod("quality",0);
- end
- end
- end),5000);
- this.lastVideoId = this.videoId;
- end
- if (not _eq(this.volume,this.lastVolume)) then
- this.player:callMethod("volume",(function() if (_lt(this.volume,100)) then return this.volume; else return 99; end end)());
- this.lastVolume = this.volume;
- end
- end
- end);
- this.onReady = (function (this)
- local self;
- this.player = viewer;
- self = this;
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- self = this;
- setTimeout(_ENV,(function (this)
- self:onReady();
- end),2000);
- end);
- registerPlayer(_ENV,"ustreamlive",UstreamLiveVideo);
- YukiTheaterRTMP = (function (this)
- local self,viewer,player__container,pre__player;
- videojs.options.flash.swf = "video-js-5.9.2/video-js.swf";
- pre__player = document:createElement("video");
- pre__player.className = "video-js vjs-default-skin";
- pre__player.id = "player";
- pre__player.preload = "auto";
- pre__player.autoplay = "true";
- player__container = document:getElementById("player").parentNode;
- player__container:removeChild(document:getElementById("player"));
- player__container:appendChild(pre__player);
- viewer = videojs(_ENV,"player");
- viewer:poster("http://www.yukitheater.org/theater/rtmp-thumbnail.png");
- this.setVideo = (function (this, id)
- this.lastVideoId = null;
- this.videoId = id;
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = (volume / 100);
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.think = (function (this)
- local curTime;
- if (not _eq(this.player,null)) then
- if (not _eq(this.videoId,this.lastVideoId)) then
- this.player:src(_obj({
- ["type"] = "rtmp/mp4",
- ["src"] = ((_addStr1("rtmp://rtmp.yukitheater.org/live/",this.videoId)) .. "/")
- }));
- this.lastVideoId = this.videoId;
- this.lastSrcChange = (_addNum2(Math:round((Date:now() / 1000)),5));
- end
- if (not _eq(this.lastSrcChange,"undefined")) then
- curTime = Math:round((Date:now() / 1000));
- if ((function() if (_ge(curTime,this.lastSrcChange)) then return (this.player:readyState() == 0); else return (_ge(curTime,this.lastSrcChange)); end end)()) then
- console:log("Attempt to load RTMP Stream Failed! Retrying...");
- this.player:src(_obj({
- ["type"] = "rtmp/mp4",
- ["src"] = ((_addStr1("rtmp://rtmp.yukitheater.org/live/",this.videoId)) .. "/")
- }));
- this.lastSrcChange = (_addNum2(Math:round((Date:now() / 1000)),5));
- end
- end
- if (not _eq(this.volume,this.lastVolume)) then
- this.player:volume(this.volume);
- this.lastVolume = this.volume;
- end
- end
- end);
- this.onReady = (function (this)
- local self;
- this.player = viewer;
- self = this;
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- this.toggleControls = (function (this, enabled)
- this.player:controls(enabled);
- end);
- self = this;
- viewer:ready((function (this)
- self:onReady();
- end));
- end);
- registerPlayer(_ENV,"yukirtmp",YukiTheaterRTMP);
- Kiss = (function (this)
- local self,viewer;
- jwplayer.key = "GBbtI9R8M4R2gQOTSs7m7AdoMdxpK3DD4IcgmQ==";
- viewer = jwplayer(_ENV,"player");
- viewer:setup(_obj({
- ["height"] = "100%",
- ["width"] = "100%",
- ["controls"] = false,
- ["autostart"] = true,
- ["primary"] = "flash",
- ["displaytitle"] = true,
- ["file"] = "example.mp4"
- }));
- this.setVideo = (function (this, id)
- this.lastStartTime = null;
- this.lastVideoId = null;
- this.videoId = id;
- this.sentKissDuration = false;
- this.initSeek = false;
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = volume;
- end);
- this.setStartTime = (function (this, seconds)
- this.lastStartTime = null;
- this.startTime = seconds;
- end);
- this.seek = (function (this, seconds)
- if (not _eq(this.player,null)) then
- this.player:seek(seconds);
- if ((_eq(this.player:getState(),"paused")) and (_eq(this.player:getState(),"paused")) or (_eq(this.player:getState(),"idle"))) then
- this.player:play(true);
- end
- end
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.getCurrentTime = (function (this)
- if (not _eq(this.player,null)) then
- do return this.player:getPosition(); end
- end
- end);
- this.canChangeTime = (function (this)
- if (not _eq(this.player,null)) then
- do return (not _eq(this.player:getState(),"buffering")); end
- end
- end);
- this.think = (function (this)
- local self,i,defaultQuality,resMatching,qualityLevels;
- if (not _eq(this.player,null)) then
- if _bool(((function() if _bool(theater:isForceVideoRes()) then return (_eq(this.player:getState(),"playing")); else return theater:isForceVideoRes(); end end)())) then
- if (not _eq(this.lastWindowHeight,window.innerHeight)) then
- qualityLevels = this.player:getPlaylist()[0].sources;
- resMatching = _arr({},0);
- defaultQuality = null;
- i = 0;
- while (_lt(i,qualityLevels.length)) do
- resMatching[qualityLevels[i]["label"]] = i;
- if _bool(qualityLevels[i]["default"]) then
- defaultQuality = i;
- end
- i = _inc(i);
- end
- if (_eq(defaultQuality,null)) then
- defaultQuality = (function() if (_in(resMatching,"720p")) then return resMatching["720p"]; else return 1; end end)();
- end
- if ((function() if (_le(window.innerHeight,1536)) then return (_gt(window.innerHeight,1440)); else return (_le(window.innerHeight,1536)); end end)()) then
- this.forceRes = (function() if (_in(resMatching,"1080p")) then return resMatching["1080p"]; else return defaultQuality; end end)();
- end
- if ((function() if (_le(window.innerHeight,1440)) then return (_gt(window.innerHeight,1080)); else return (_le(window.innerHeight,1440)); end end)()) then
- this.forceRes = (function() if (_in(resMatching,"1080p")) then return resMatching["1080p"]; else return defaultQuality; end end)();
- end
- if ((function() if (_le(window.innerHeight,1080)) then return (_gt(window.innerHeight,720)); else return (_le(window.innerHeight,1080)); end end)()) then
- this.forceRes = (function() if (_in(resMatching,"1080p")) then return resMatching["1080p"]; else return defaultQuality; end end)();
- end
- if ((function() if (_le(window.innerHeight,720)) then return (_gt(window.innerHeight,480)); else return (_le(window.innerHeight,720)); end end)()) then
- this.forceRes = (function() if (_in(resMatching,"720p")) then return resMatching["720p"]; else return defaultQuality; end end)();
- end
- if ((function() if (_le(window.innerHeight,480)) then return (_gt(window.innerHeight,360)); else return (_le(window.innerHeight,480)); end end)()) then
- this.forceRes = (function() if (_in(resMatching,"480p")) then return resMatching["480p"]; else return defaultQuality; end end)();
- end
- if ((function() if (_le(window.innerHeight,360)) then return (_gt(window.innerHeight,240)); else return (_le(window.innerHeight,360)); end end)()) then
- this.forceRes = (function() if (_in(resMatching,"360p")) then return resMatching["360p"]; else return defaultQuality; end end)();
- end
- if (_le(window.innerHeight,240)) then
- this.forceRes = (function() if (_in(resMatching,"240p")) then return resMatching["240p"]; else return defaultQuality; end end)();
- end
- this.player:setCurrentQuality(this.forceRes);
- console:log((_addStr1("Forcing Quality Change to ",this.forceRes)));
- this.lastWindowHeight = window.innerHeight;
- end
- end
- if (not _eq(this.videoId,this.lastVideoId)) then
- self = this;
- setTimeout(_ENV,(function (this)
- if (not _bool(self.player:getPlaylist()[0]) and not _bool(self.player:getPlaylist()[0]) or (_eq(self.player:getPlaylist()[0].file,"example.mp4"))) then
- self:onRemove();
- theater:getPlayerContainer().innerHTML = "<div id='player'><div style='color: red;'>ERROR: Kiss Video Sources Load Failure</div></div>";
- do return end
- end
- end),30000);
- if (this.videoId:lastIndexOf("ol_",0) == 0) then
- eval(_ENV,base64:decode(this.videoId:replace("ol_","")));
- if ((function() if (_type(vs) ~= "undefined") then return (_type(vs) ~= "null"); else return (_type(vs) ~= "undefined"); end end)()) then
- this.player:load(_arr({[0]=_obj({
- ["file"] = vs
- })},1));
- vs = null;
- end
- elseif (this.videoId:lastIndexOf("jw_aes_",0) == 0) then
- this.player:load(_arr({[0]=_obj({
- ["sources"] = eval(_ENV,Skissenc__aes:decrypt(this.videoId:replace("jw_aes_","")))
- })},1));
- elseif (this.videoId:lastIndexOf("jw_sha256_",0) == 0) then
- this.player:load(_arr({[0]=_obj({
- ["sources"] = eval(_ENV,Skissenc__sha256:decrypt(this.videoId:replace("jw_sha256_","")))
- })},1));
- else
- this.player:load(_arr({[0]=_obj({
- ["sources"] = eval(_ENV,atob(_ENV,this.videoId:replace("jw_","")))
- })},1));
- end
- this.lastVideoId = this.videoId;
- this.lastStartTime = this.startTime;
- end
- if ((function() if ((function() if not _bool(this.sentKissDuration) then return (_eq(this.player:getState(),"playing")); else return not _bool(this.sentKissDuration); end end)()) then return (_gt(this.player:getDuration(),0)); else return ((function() if not _bool(this.sentKissDuration) then return (_eq(this.player:getState(),"playing")); else return not _bool(this.sentKissDuration); end end)()); end end)()) then
- console:log(((_addStr1("RUNLUA: theater.SendKissDuration(",this.player:getDuration())) .. ")"));
- this.sentKissDuration = true;
- end
- if (not _eq(this.player:getState(),"idle")) then
- if (not _eq(this.startTime,this.lastStartTime)) then
- this:seek(this.startTime);
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.volume,this.player:getVolume())) then
- this.player:setVolume(this.volume);
- this.volume = this.player:getVolume();
- end
- end
- end
- end);
- this.onReady = (function (this)
- local self;
- this.player = viewer;
- self = this;
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- this.toggleControls = (function (this, enabled)
- this.player:setControls(enabled);
- end);
- self = this;
- viewer:on("ready",(function (this)
- self:onReady();
- end));
- end);
- registerPlayer(_ENV,"kissanime",Kiss);
- registerPlayer(_ENV,"kissasian",Kiss);
- registerPlayer(_ENV,"kisscartoon",Kiss);
- KissYT = (function (this)
- local url,attributes,params;
- params = _obj({
- ["allowScriptAccess"] = "always",
- ["bgcolor"] = "#000000",
- ["wmode"] = "opaque"
- });
- attributes = _obj({
- ["id"] = "player"
- });
- url = "https://www.youtube.com/get_player?enablejsapi=1&modestbranding=1";
- this.setVideo = (function (this, id)
- local v,k,flashvars;
- this.lastStartTime = null;
- this.lastVideoId = null;
- this.videoId = id;
- if (id:lastIndexOf("yt_aes_",0) == 0) then
- id = Skissenc__aes:decrypt(id:replace("yt_aes_",""));
- elseif (id:lastIndexOf("yt_sha256_",0) == 0) then
- id = Skissenc__sha256:decrypt(id:replace("yt_sha256_",""));
- else
- id = atob(_ENV,id:replace("yt_",""));
- end
- flashvars = _obj({});
- local _p = _props(id:split("&"), true);
- for _,k in _ipairs(_p) do
- k = _tostr(k);
- local _p = _props(id:split("&")[k]:split("="), true);
- for _,v in _ipairs(_p) do
- v = _tostr(v);
- if ((function() if (not _eq(_type(id:split("&")[k]:split("=")[(v - 1)]),"undefined")) then return (not _eq(_type(id:split("&")[k]:split("=")[v]),"undefined")); else return (not _eq(_type(id:split("&")[k]:split("=")[(v - 1)]),"undefined")); end end)()) then
- flashvars[id:split("&")[k]:split("=")[(v - 1)]:replace("amp;","")] = id:split("&")[k]:split("=")[v];
- end
- ::_continue::
- end
- ::_continue::
- end
- swfobject:embedSWF(url,"player","100%","100%","9",null,flashvars,params,attributes);
- this.sentKissDuration = false;
- this.initSeek = false;
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = volume;
- end);
- this.setStartTime = (function (this, seconds)
- this.lastStartTime = null;
- this.startTime = seconds;
- end);
- this.seek = (function (this, seconds)
- if (not _eq(this.player,null)) then
- this.player:seekTo(seconds,true);
- if (not _eq(this.player:getPlayerState(),1)) then
- this.player:playVideo();
- end
- end
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.getCurrentTime = (function (this)
- if (not _eq(this.player,null)) then
- do return this.player:getCurrentTime(); end
- end
- end);
- this.canChangeTime = (function (this)
- if (not _eq(this.player,null)) then
- do return ((function() if (not _eq(this.player:getVideoBytesTotal(),-1)) then return (not _eq(this.player:getPlayerState(),3)); else return (not _eq(this.player:getVideoBytesTotal(),-1)); end end)()); end
- end
- end);
- this.think = (function (this)
- local self;
- if (not _eq(this.player,null)) then
- if _bool(theater:isForceVideoRes()) then
- if (not _eq(this.lastWindowHeight,window.innerHeight)) then
- if ((function() if (_le(window.innerHeight,1536)) then return (_gt(window.innerHeight,1440)); else return (_le(window.innerHeight,1536)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1440)) then return (_gt(window.innerHeight,1080)); else return (_le(window.innerHeight,1440)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1080)) then return (_gt(window.innerHeight,720)); else return (_le(window.innerHeight,1080)); end end)()) then
- this.ytforceres = "hd1080";
- end
- if ((function() if (_le(window.innerHeight,720)) then return (_gt(window.innerHeight,480)); else return (_le(window.innerHeight,720)); end end)()) then
- this.ytforceres = "hd720";
- end
- if ((function() if (_le(window.innerHeight,480)) then return (_gt(window.innerHeight,360)); else return (_le(window.innerHeight,480)); end end)()) then
- this.ytforceres = "large";
- end
- if ((function() if (_le(window.innerHeight,360)) then return (_gt(window.innerHeight,240)); else return (_le(window.innerHeight,360)); end end)()) then
- this.ytforceres = "medium";
- end
- if (_le(window.innerHeight,240)) then
- this.ytforceres = "small";
- end
- this.player:setPlaybackQuality(this.ytforceres);
- console:log((_addStr1("Forcing Quality Change to ",this.ytforceres)));
- this.lastWindowHeight = window.innerHeight;
- end
- end
- if (not _eq(this.videoId,this.lastVideoId)) then
- this.lastVideoId = this.videoId;
- this.lastStartTime = this.startTime;
- self = this;
- setTimeout(_ENV,(function (this)
- if ((function() if (_type(self.player.getPlayerState) == "function") then return (_eq(self.player:getPlayerState(),-1)); else return (_type(self.player.getPlayerState) == "function"); end end)()) then
- theater:getPlayerContainer().innerHTML = "<div id='player'><div style='color: red;'>ERROR: Kiss Video Sources Load Failure</div></div>";
- do return end
- end
- end),30000);
- end
- if ((function() if ((function() if not _bool(this.sentKissDuration) then return (_type(this.player.getDuration) == "function"); else return not _bool(this.sentKissDuration); end end)()) then return (_gt(this.player:getDuration(),0)); else return ((function() if not _bool(this.sentKissDuration) then return (_type(this.player.getDuration) == "function"); else return not _bool(this.sentKissDuration); end end)()); end end)()) then
- console:log(((_addStr1("RUNLUA: theater.SendKissDuration(",this.player:getDuration())) .. ")"));
- this.sentKissDuration = true;
- end
- if ((function() if (_type(this.player.getPlayerState) == "function") then return (not _eq(this.player:getPlayerState(),-1)); else return (_type(this.player.getPlayerState) == "function"); end end)()) then
- if not _bool(this.initSeek) then
- this:seek((_addNum2(this.startTime,3)));
- this.initSeek = true;
- end
- if (not _eq(this.startTime,this.lastStartTime)) then
- this:seek(this.startTime);
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.volume,this.player:getVolume())) then
- this.player:setVolume(this.volume);
- this.volume = this.player:getVolume();
- end
- end
- end
- end);
- this.onReady = (function (this)
- local self;
- this.player = document:getElementById("player");
- if _bool(theater:isForceVideoRes()) then
- if ((function() if (_le(window.innerHeight,1536)) then return (_gt(window.innerHeight,1440)); else return (_le(window.innerHeight,1536)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1440)) then return (_gt(window.innerHeight,1080)); else return (_le(window.innerHeight,1440)); end end)()) then
- this.ytforceres = "highres";
- end
- if ((function() if (_le(window.innerHeight,1080)) then return (_gt(window.innerHeight,720)); else return (_le(window.innerHeight,1080)); end end)()) then
- this.ytforceres = "hd1080";
- end
- if ((function() if (_le(window.innerHeight,720)) then return (_gt(window.innerHeight,480)); else return (_le(window.innerHeight,720)); end end)()) then
- this.ytforceres = "hd720";
- end
- if ((function() if (_le(window.innerHeight,480)) then return (_gt(window.innerHeight,360)); else return (_le(window.innerHeight,480)); end end)()) then
- this.ytforceres = "large";
- end
- if ((function() if (_le(window.innerHeight,360)) then return (_gt(window.innerHeight,240)); else return (_le(window.innerHeight,360)); end end)()) then
- this.ytforceres = "medium";
- end
- if (_le(window.innerHeight,240)) then
- this.ytforceres = "small";
- end
- this.player:setPlaybackQuality(this.ytforceres);
- console:log((_addStr1("Forcing Quality Change to ",this.ytforceres)));
- this.lastWindowHeight = window.innerHeight;
- end
- self = this;
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- end);
- registerPlayer(_ENV,"kissyoutube",KissYT);
- Dailymotion = (function (this)
- local self,viewer;
- viewer = DM:player(document:getElementById("player"),_obj({
- ["width"] = "100%",
- ["height"] = "100%",
- ["params"] = _obj({
- ["autoplay"] = true,
- ["controls"] = true
- })
- }));
- this.setVideo = (function (this, id)
- this.lastStartTime = null;
- this.lastVideoId = null;
- this.videoId = id;
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = (volume / 100);
- end);
- this.setStartTime = (function (this, seconds)
- this.lastStartTime = null;
- this.startTime = seconds;
- end);
- this.seek = (function (this, seconds)
- if (not _eq(this.player,null)) then
- this.player:seek(seconds);
- if _bool(this.player.paused) then
- this.player:play();
- end
- end
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.getCurrentTime = (function (this)
- if (not _eq(this.player,null)) then
- do return this.player.currentTime; end
- end
- end);
- this.think = (function (this)
- if (not _eq(this.player,null)) then
- if (not _eq(this.videoId,this.lastVideoId)) then
- this.player:load(this.videoId,_obj({
- ["autoplay"] = true,
- ["start"] = this.startTime
- }));
- this.lastVideoId = this.videoId;
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.startTime,this.lastStartTime)) then
- this:seek(this.startTime);
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.volume,this.lastVolume)) then
- this.player:setVolume(this.volume);
- this.lastVolume = this.player.volume;
- end
- end
- end);
- this.onReady = (function (this)
- local self;
- this.player = viewer;
- self = this;
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- this.toggleControls = (function (this, enabled)
- end);
- self = this;
- viewer:addEventListener("apiready",(function (this)
- self:onReady();
- end));
- end);
- registerPlayer(_ENV,"dailymotion",Dailymotion);
- registerPlayer(_ENV,"dailymotionlive",Dailymotion);
- HitboxLive = (function (this)
- local self,viewer,player__container,pre__player;
- videojs.options.flash.swf = "video-js-5.9.2/video-js.swf";
- pre__player = document:createElement("video");
- pre__player.className = "video-js vjs-default-skin";
- pre__player.id = "player";
- pre__player.preload = "auto";
- pre__player.autoplay = "true";
- player__container = document:getElementById("player").parentNode;
- player__container:removeChild(document:getElementById("player"));
- player__container:appendChild(pre__player);
- viewer = videojs(_ENV,"player");
- this.setVideo = (function (this, id)
- this.lastStartTime = null;
- this.lastVideoId = null;
- this.videoId = id;
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = (volume / 100);
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.think = (function (this)
- local self,playerJSON;
- if (not _eq(this.player,null)) then
- if (not _eq(this.videoId,this.lastVideoId)) then
- playerJSON = _new(XMLHttpRequest);
- self = this;
- playerJSON.onreadystatechange = (function (this)
- local parsedJSON;
- if ((function() if (_eq(playerJSON.readyState,4)) then return (_eq(playerJSON.status,200)); else return (_eq(playerJSON.readyState,4)); end end)()) then
- parsedJSON = JSON:parse(playerJSON.responseText);
- self.player:src(_obj({
- ["type"] = "application/x-mpegURL",
- ["src"] = parsedJSON["clip"]["url"]
- }));
- end
- end);
- playerJSON:open("GET",((_addStr1("https://www.hitbox.tv/api/player/config/live/",this.videoId)) .. "?autoplay=true&embed=true&no_interruption=false&ssl=true"),true);
- playerJSON:send();
- this.lastVideoId = this.videoId;
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.volume,this.lastVolume)) then
- this.player:volume(this.volume);
- this.lastVolume = this.volume;
- end
- end
- end);
- this.onReady = (function (this)
- local self;
- this.player = viewer;
- self = this;
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- this.toggleControls = (function (this, enabled)
- this.player:controls(enabled);
- end);
- self = this;
- viewer:ready((function (this)
- self:onReady();
- end));
- end);
- registerPlayer(_ENV,"hitboxlive",HitboxLive);
- Hitbox = (function (this)
- local self,viewer,player__container,pre__player;
- videojs.options.flash.swf = "video-js-5.9.2/video-js.swf";
- pre__player = document:createElement("video");
- pre__player.className = "video-js vjs-default-skin";
- pre__player.id = "player";
- pre__player.preload = "auto";
- pre__player.autoplay = "true";
- player__container = document:getElementById("player").parentNode;
- player__container:removeChild(document:getElementById("player"));
- player__container:appendChild(pre__player);
- viewer = videojs(_ENV,"player");
- this.setVideo = (function (this, id)
- this.lastStartTime = null;
- this.lastVideoId = null;
- this.videoId = id;
- end);
- this.setVolume = (function (this, volume)
- this.lastVolume = null;
- this.volume = (volume / 100);
- end);
- this.setStartTime = (function (this, seconds)
- this.lastStartTime = null;
- this.startTime = seconds;
- end);
- this.seek = (function (this, seconds)
- if (not _eq(this.player,null)) then
- this.player:currentTime(seconds);
- if _bool(this.player:paused()) then
- this.player:play();
- end
- end
- end);
- this.onRemove = (function (this)
- clearInterval(_ENV,this.interval);
- end);
- this.getCurrentTime = (function (this)
- if (not _eq(this.player,null)) then
- do return this.player:currentTime(); end
- end
- end);
- this.think = (function (this)
- if (not _eq(this.player,null)) then
- if (not _eq(this.videoId,this.lastVideoId)) then
- this.player:src(_obj({
- ["type"] = "application/x-mpegURL",
- ["src"] = ((_addStr1("http://www.hitbox.tv/api/player/hlsvod/",this.videoId)) .. ".m3u8")
- }));
- this.lastVideoId = this.videoId;
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.startTime,this.lastStartTime)) then
- this:seek(this.startTime);
- this.lastStartTime = this.startTime;
- end
- if (not _eq(this.volume,this.lastVolume)) then
- this.player:volume(this.volume);
- this.lastVolume = this.volume;
- end
- end
- end);
- this.onReady = (function (this)
- local self;
- this.player = viewer;
- self = this;
- this.interval = setInterval(_ENV,(function (this)
- self:think(self);
- end),100);
- end);
- this.toggleControls = (function (this, enabled)
- this.player:controls(enabled);
- end);
- self = this;
- viewer:ready((function (this)
- self:onReady();
- end));
- end);
- registerPlayer(_ENV,"hitbox",Hitbox);
- end)(_ENV);
- if _bool(window.onTheaterReady) then
- onTheaterReady(_ENV);
- end
- console:log((_addStr1("Loaded theater.js v",theater.VERSION)));
Add Comment
Please, Sign In to add comment