123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
-
- GLOB_ORIG = "glob_orig_v2"
-
-
-
- function FS_dec_proto_v2(fn,fn_name) {
- return function() {
- clog("fdp0",fn_name,glob_react.Filmstrip._getThumbs())
- dec_fns[fn_name] && dec_fns[fn_name].pre ? dec_fns[fn_name].pre({that:this, arguments}) : 1
- if (fn_name == "updateDOMLocation") {
- this.updateDOMLocation2()
- }
- const ret = fn.apply(this, arguments);
- // console.log('FSD',fn_name,ret, [this,...arguments]);
- // console.log('FSD',fn_name);
-
- // console.trace('FSD_trc '+fn_name);
- // log_tb()
- // window.log_tb(new Error(),fn_name)
- // clog("rtscv1",glob_react.Filmstrip._getThumbs())
- // resizeThumbnailsForCustomView(this,fn_name,arguments)
- clog("fdp2",fn_name,glob_react.Filmstrip._getThumbs())
- const ret2 = dec_fns[fn_name] && dec_fns[fn_name].post ? dec_fns[fn_name].post({that:this, arguments}) : 0
- if (ret2){
- return ret2.ret
- }
- // const result = fn.apply(this, arguments);
- // console.log('Finished');
- // clog("rtscv2",glob_react.Filmstrip._getThumbs())
- return ret;
- }
- }
-
- function undec_class_v2(cls,cls_orig,cname){
- var k,v
- var proto = cls_orig
- // var proto = glob_react.vidClass.LocalVideo.prototype
- // for ([k,v] of iter_desc(proto)){
- for ([k,v] of Object.entries(proto)){
- // glob_react.Filmstrip[k] = v
- // clog(k,v)
- cls.prototype[k] = v.value
- // clog(k,v)
- }
- }
-
- function _method_dec_v2(fn,fn_name){
- return function() {
- // clog("fdp0",fn_name,glob_react.Filmstrip._getThumbs())
- const ret1 = dec_fns[fn_name] && dec_fns[fn_name].pre ? dec_fns[fn_name].pre({that:this, args:arguments}) : 0
- // if (fn_name == "updateDOMLocation") {
- // this.updateDOMLocation2()
- // }
- if (ret1){
- return ret1.ret
- }
- const ret = fn.apply(this, arguments);
- // clog("MDV2",fn_name,{that:this, args:arguments,ret:ret})
- // clog("MDV2 xyz",fn_name,{that:this, args:arguments,ret:ret})
- // console.log('FSD',fn_name,ret, [this,...arguments]);
- // console.log('FSD',fn_name);
-
- // console.trace('FSD_trc '+fn_name);
- // log_tb()
- // window.log_tb(new Error(),fn_name)
- // clog("rtscv1",glob_react.Filmstrip._getThumbs())
- // resizeThumbnailsForCustomView(this,fn_name,arguments)
- // clog("fdp2",fn_name,glob_react.Filmstrip._getThumbs())
-
-
- const ret2 = dec_fns[fn_name] && dec_fns[fn_name].post ? dec_fns[fn_name].post({that:this, arguments}) : 0
- // clog("MDEX",{ret1,ret2})
- if (ret2){
- return ret2.ret
- }
- // const result = fn.apply(this, arguments);
- // console.log('Finished');
- // clog("rtscv2",glob_react.Filmstrip._getThumbs())
- return ret;
- }
- }
-
- function _method_dec_v2_1(fn,fn_name,cname){
- return function() {
-
- window.sv_trc ? sv_trc({fn_name,cname,that:this,args:[...arguments]}) : 0
- // const ret1 = dec_fns[fn_name] && dec_fns[fn_name].pre ? dec_fns[fn_name].pre({that:this, args:arguments}) : 0
- // const ret1 = dec_fns[fn_name] && dec_fns[fn_name].pre ? dec_fns[fn_name].pre.call(this,[{that:this, args:arguments}]) : 0
- const ret1 = dec_fns[fn_name] && dec_fns[fn_name].pre ? dec_fns[fn_name].pre.apply(this,[{that:this, args:arguments}]) : 0
-
- if (ret1){
- return ret1.ret
- }
- const ret = fn.apply(this, arguments);
- const ret2 = dec_fns[fn_name] && dec_fns[fn_name].post ? dec_fns[fn_name].post({that:this, arguments}) : 0
- // clog("MDEX",{ret1,ret2})
- if (ret2){
- return ret2.ret
- }
- return ret;
- }
- }
-
- function _method_dec_v2_2(fn,fn_name){
- return function() {
-
- const ret1 = dec_fns[fn_name] && dec_fns[fn_name].pre ? dec_fns[fn_name].pre({that:this, args:arguments}) : 0
-
- if (ret1){
- return ret1.ret
- }
- const ret = fn.apply(this, arguments);
- const ret2 = dec_fns[fn_name] && dec_fns[fn_name].post ? dec_fns[fn_name].post({that:this, arguments}) : 0
- // clog("MDEX",{ret1,ret2})
- if (ret2){
- return ret2.ret
- }
- return ret;
- }
- }
-
-
-
-
-
-
-
- function dec_class_v2(cls,cls_orig,cname){
- clog("trc dec_class_v2",cname,{cls,cls_orig,cname})
- var k,v
- var proto = cls_orig
- // var proto = glob_react.vidClass.LocalVideo.prototype
- // for ([k,v] of iter_desc(proto)){
- for ([k,v] of Object.entries(proto)){
- // glob_react.Filmstrip[k] = v
- // clog(k,v)
- cls.prototype[k] = _method_dec_v2(v.value,k)
- // clog(k,v)
- }
- }
- function dec_class_v2_1(cls,cls_orig,cname){
- clog("trc dec_class_v2",cname,{cls,cls_orig,cname})
- var k,v
- var proto = cls_orig
- // var proto = glob_react.vidClass.LocalVideo.prototype
- // for ([k,v] of iter_desc(proto)){
- for ([k,v] of Object.entries(proto)){
- // glob_react.Filmstrip[k] = v
- // clog(k,v)
- cls.prototype[k] = _method_dec_v2_1(v.value,k,cname)
- // clog(k,v)
- }
- }
-
-
-
- function save_orig_class(cls){
- var i,k,v
- var i2,k2,v2
- var o
- var ret = {}
- // o = glob_react.vidClass.LocalVideo.prototype
- // o = tobj
- // o = glob_react.vidClass.LocalVideo
- // for ([k,v] of Object.entries(glob_react.vidClass)){
- // for ([k,v] of Object.entries(o)){
- // for ([k2,v2] of Object.entries(glob_react.vidClass)){
- // for ([k2,v2] of Object.entries(classes)){
- // clog("...",k2)
- // ret[k2] = {}
- o = cls.prototype
- for ([k,v] of iter_desc(o)){
-
- // clog(k,v)
- ret[k]=v
- // clog(k2,k,v)
- }
- // }
- // clog("><",Object.getOwnPropertyDescriptors(o))
- return ret
-
- }
- // dec_fns
-
-
- function init_cdec(){
- let runonce = !window[GLOB_ORIG]
- // runonce = 1
- // if (!window[GLOB_ORIG]){
- // }
- window[GLOB_ORIG] = window[GLOB_ORIG] || {
- classes:{}
- }
- cdec.glob_orig = window[GLOB_ORIG]
- if (runonce){
-
- window[GLOB_ORIG].classes["SharedVideoManager"] = cdec.get_class_methods(glob_react.SharedVideoManager)
- window[GLOB_ORIG].classes["SharedVideoContainer"] = cdec.get_class_methods(glob_react.SharedVideoContainer)
- //
- }
-
- }
-
-
-
- function undec_svm(){
- cdec.undec_class(glob_react.SharedVideoManager,cdec.glob_orig.classes.SharedVideoManager)
-
- }
- function dec_svm(){
- cdec.dec_class(glob_react.SharedVideoManager,cdec.glob_orig.classes.SharedVideoManager,"SharedVideoManager")
- cdec.dec_class(glob_react.SharedVideoContainer,cdec.glob_orig.classes.SharedVideoContainer,"SharedVideoContainer")
-
- }
- // function dec_svm(){}
- function onSharedVideoUpdate_mod(id, url, attributes) {
- // if we are sending the event ignore
- if (APP.conference.isLocalId(this.from)) {
- return;
- }
-
- if (!this.isSharedVideoShown) {
- this.onSharedVideoStart(id, url, attributes);
-
- return;
- }
-
- // eslint-disable-next-line no-negated-condition
- if (!this.player) {
- this.initialAttributes = attributes;
- } else {
- this.processVideoUpdate(this.player, attributes);
- }
- }
-
- dec_fns_v2 = {
- fireSharedVideoEvent:{
-
- pre(o) {
- // return
- const sendPauseEvent = o.args[0]
- const UIEvents = glob_react.UIEvents
- clog("fireSharedVideoEventx",this,o,o.args[0],[...arguments])
- // return {}
- // return
- // ignore update checks if we are not the owner of the video
- // or there is still no player defined or we are stopped
- // (in a process of stopping)
- if (!APP.conference.isLocalId(this.from) || !this.player
- || !this.isSharedVideoShown) {
- // return;
- return {};
- }
-
- const state = this.player.getPlayerState();
-
- // if its paused and haven't been pause - send paused
-
- if (state === YT.PlayerState.PAUSED && sendPauseEvent) {
- this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO,
- this.url, 'pause', this.player.getCurrentTime());
- } else if (state === YT.PlayerState.PLAYING) {
- // if its playing and it was paused - send update with time
- // if its playing and was playing just send update with time
- this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO,
- this.url, 'playing',
- this.player.getCurrentTime(),
- this.player.isMuted(),
- this.player.getVolume(),);
- // this.player.getVolume(),"xtra_var");
- }
- return {};
- }
- },
- onSharedVideoUpdate:{
- pre(o){
- try {
- if (!o.that.player){
- window.autoplay_probably_disabled ? autoplay_probably_disabled(o) : clog("NO fix implemented")
- // window.autoplay_probably_disabled ? autoplay_probably_disabled(o) : clog("NO fix implemented2")
- clog("...autoplay_probably_disabled...")
- } else {
- // clog("yt_dbg AUTO")
- }
- /*
- clog("onSharedVideoUpdate pre arg",[...o.args])
- // clog("onSharedVideoUpdate pre",o.args[2],o.that.isSharedVideoShown,!this.player)
- clog("onSharedVideoUpdate pre",o.args[2],!o.that.isSharedVideoShown,!o.that.player)
- // onSharedVideoUpdate_mod.apply(o.that, o.args);
- try {
- clog("osvu player",o.that.player)
- o.that.player.g.g.playerVars
-
- } catch (err){
- clog("osvu err")
- }
-
- clog("onSharedVideoUpdate...",o.that.player)
-
- */
- // return {}
-
- } catch (err){clog("dec fn err svm",err)}
- // return onSharedVideoUpdate_mod.apply(o.that, o.args);
- // return onSharedVideoUpdate_mod.apply(o.that, o.args);
-
- },
- post_x(o){
- try {
-
- // clog("onSharedVideoUpdate post",o)
- } catch (err){clog("dec fn err svm")}
-
- },
- }
- }
-
-
-
-
-
- // clog("TRC_ <!--#echo var='request_filename' -->",'<!--#echo var="uri" -->')
- clog("TRC_2 ",'<!--#echo var="request_filename" -->'.split("/").pop())
-
- cdec = {
- get_class_methods:save_orig_class,
- undec_class:undec_class_v2,
- // dec_class:dec_class_v2,
- dec_class:dec_class_v2_1,
- glob_orig:window[GLOB_ORIG],
- }
- dec_fns = window.dec_fns || {}
- Object.assign(dec_fns,dec_fns_v2)
- init_cdec()
- dec_svm()
|