You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

m0.js 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. glob_mx.filmstrip_handlers[undefined] = function function_name(argument) {
  2. clog("default FN HANDLER")
  3. }
  4. glob_mx.dims = glob_mx.dims || {}
  5. dflt_css = {
  6. 'padding-top': '',
  7. "min-height": ``,
  8. "min-width": ``,
  9. width: ``,
  10. height: ``,
  11. }
  12. function fix_avatar(vid){
  13. var k,v,bcr
  14. for (v of $(vid).filter(".remote_vid,.local_vid")){
  15. bcr = v.getBoundingClientRect()
  16. $(v).find(".avatar-container").css({
  17. width:Math.ceil(bcr.height * .75),
  18. height:Math.ceil(bcr.height * .75),
  19. })
  20. }
  21. }
  22. function resize_thumbs_vertical(cont){
  23. const computed_css = Object.assign({},dflt_css)
  24. var aspect = 16/9
  25. var width = 335
  26. var thumbs = $(cont).children(".small_vid")
  27. width = $(cont).width() - 1
  28. width = glob_mx.dims.w5
  29. // computed_css["--v_index"]=`"VERT"`
  30. var height = Math.round(width/aspect)
  31. computed_css.height = height
  32. computed_css["min-height"] = height
  33. computed_css.width = width
  34. computed_css["min-width"] = width
  35. var k,v
  36. for ([k,v] of Object.entries(computed_css)){
  37. Number(v) ? computed_css[k] = v + "px" : 0
  38. }
  39. // clog("RTHUMBS")
  40. thumbs.css(computed_css)
  41. fix_avatar(thumbs)
  42. }
  43. function resize_thumbs_horizontal(cont){
  44. const computed_css = Object.assign({},dflt_css)
  45. var aspect = 16/9
  46. var width = 335
  47. // computed_css["--v_index"]=`"horizontal"`
  48. var thumbs = $(cont).children(".small_vid")
  49. width = ($(cont).height() * aspect)
  50. width = ($(cont).height() * aspect) - 1
  51. width = Math.floor(glob_mx.dims.w5)
  52. var height = Math.round(width/aspect)
  53. computed_css.height = height
  54. computed_css.width = width
  55. clog("RTH",cont)
  56. computed_css["min-width"] = width
  57. var k,v
  58. for ([k,v] of Object.entries(computed_css)){
  59. Number(v) ? computed_css[k] = v + "px" : 0
  60. }
  61. // clog("RTHUMBS")
  62. fix_avatar(thumbs)
  63. thumbs.css(computed_css)
  64. }
  65. function resize_thumbs_center(cont){
  66. const computed_css = Object.assign({},dflt_css)
  67. var aspect = 16/9
  68. var width = 335
  69. // computed_css["--v_index"]=`"horizontal"`
  70. var thumbs = $(cont).children(".small_vid")
  71. width = ($(cont).width() ) - 10
  72. var height = Math.round(width/aspect)
  73. computed_css.height = height
  74. computed_css.width = width
  75. var k,v
  76. for ([k,v] of Object.entries(computed_css)){
  77. Number(v) ? computed_css[k] = v + "px" : 0
  78. }
  79. // clog("RTHUMBS")
  80. thumbs.css(computed_css)
  81. fix_avatar(thumbs)
  82. }
  83. dflt_css_proto = {
  84. 'padding-top': '',
  85. "max-height": ``,
  86. "min-height": ``,
  87. "max-width": ``,
  88. "min-width": ``,
  89. width: ``,
  90. height: ``,
  91. top: ``,
  92. left: ``,
  93. bottom: ``,
  94. right: ``,
  95. position:``,
  96. tramsform:``,
  97. // right: ``,
  98. // right: ``,
  99. }
  100. function resize_thumbs_proto(thumbs,css_arg){
  101. var k,v
  102. let css
  103. if (Array.isArray(css_arg)){
  104. css = Object.assign({},dflt_css_proto,...css_arg)
  105. } else {
  106. css = Object.assign({},dflt_css_proto,css_arg)
  107. }
  108. if (typeof(css.data) == "object"){
  109. try{
  110. Object.assign($(thumbs)[0].dataset,css.data)
  111. } catch(err) {
  112. clog("dataset err",err)
  113. }
  114. }
  115. css["--vdim"] = `"${css.width} x ${css.height}"`
  116. $(thumbs).css(css)
  117. }
  118. // this handles the layout of all custom filmstrips an the large video element
  119. // todo refactor half of this into the api
  120. function calc_fs_dims(){
  121. const hd_w = 16
  122. const hd_h = 9
  123. const aspect_ratio_hd = hd_w / hd_h
  124. const aspect_ratio_65 = (hd_w * 6) / (hd_h * 5)
  125. const aspect_ratio_64 = (hd_w * 6) / (hd_h * 4)
  126. const state = APP.store.getState();
  127. var { clientHeight, clientWidth } = state['features/base/responsive-ui'];
  128. var avail_width =clientWidth
  129. // var avail_height =clientHeight - 100
  130. var avail_height =clientHeight - 45
  131. var dim_hd = glob_dev_fns.calculateThumbnailSizeForTileView_dev({
  132. columns:1,
  133. visibleRows:1,
  134. clientWidth:avail_width,
  135. clientHeight:avail_height,
  136. TILE_ASPECT_RATIO:TILE_ASPECT_RATIO ,
  137. verticalMargin:0,
  138. // sideMargins=0,
  139. // topBottomPadding:100,
  140. })
  141. let w5,h5,w53,h53,w54,h54
  142. h5 = dim_hd.height/5
  143. w5 = dim_hd.width/5
  144. let m = 10
  145. let wm = 10
  146. let hm = 8
  147. // w5 = w5 - m
  148. // h5 = h5 - m
  149. w53 = w5 * 3
  150. h53 = h5 * 3
  151. w54 = w5 * 4
  152. h54 = h5 * 4
  153. w5 = w5 - m
  154. h5 = h5 - hm
  155. glob_mx.dims.w5 = w5
  156. glob_mx.dims.h5 = h5
  157. glob_mx.dims.fw = dim_hd.width
  158. glob_mx.dims.fh = dim_hd.height
  159. glob_mx.dims.m = m
  160. h54 = h54 + (hm * 2)
  161. let vtop
  162. let vleft
  163. let s_width,h_height
  164. s_width = w53
  165. h_height = h53 + 1 * hm
  166. vleft = w5 + ( m )
  167. // = h5 + ((m * 2 ) / aspect_ratio_hd) + 1
  168. vtop = h5 + ( m * 2 ) - 2
  169. vtop = h5 + (hm * 1.5)
  170. clog("....",clientHeight - dim_hd.height > 100,clientHeight - dim_hd.height,clientHeight , dim_hd.height)
  171. var top_margin_flag
  172. if (clientHeight - dim_hd.height > 150 ) {
  173. top_margin_flag = 1
  174. // $(".fs_container").css({width:dim_hd.width,"min-height":dim_hd.height,"max-height":dim_hd.height + 100})
  175. resize_thumbs_proto($(".fs_container"),{width:dim_hd.width,"height":dim_hd.height})
  176. // top_margin_flag =
  177. // $(".fs_container").css({width:dim_hd.width,"min-height":dim_hd.height,"max-height":dim_hd.height + 100})
  178. } else {
  179. top_margin_flag = 0
  180. // resize_thumbs_proto($(".fs_container"),{width:dim_hd.width,"height":dim_hd.height})
  181. resize_thumbs_proto($(".fs_container"),{width:dim_hd.width,"min-height":dim_hd.height,"max-height":dim_hd.height + 100})
  182. }
  183. // $(".fs_container").css({width:dim_hd.width,"height":dim_hd.height})
  184. // fs_type: "vertical"
  185. resize_thumbs_proto($(".ic1"),[
  186. {
  187. width:dim_hd.width,
  188. height:h5,
  189. "--vtext":`"top_fs"`,
  190. // data:{fs_type: "vertical"},
  191. data:{fs_type: "horizontal",},
  192. },])
  193. resize_thumbs_proto($(".ic2"),[
  194. {
  195. width:w5,
  196. height:h53,
  197. top:vtop ,
  198. "--vtext":`"left_fs"`,
  199. data:{fs_type: "vertical"},
  200. },])
  201. resize_thumbs_proto($(".ic3"),[
  202. {
  203. width:w5,
  204. height:h53,
  205. top:vtop,
  206. left:w54,
  207. // left:0,
  208. // right:0,
  209. "--vtext":`"right_fs"`,
  210. data:{fs_type: "vertical"},
  211. },])
  212. let overflow_vids = $(".ic6").children(".small_vid")
  213. let overflow_obj = {}
  214. if (overflow_vids.length > 5){
  215. }
  216. overflow_obj.width = w5 * (overflow_vids.length + 1)
  217. resize_thumbs_proto($(".c6"),[{
  218. width:dim_hd.width,
  219. height:h5,
  220. height:h5 + 20,
  221. top:h54 - (hm) * .5,
  222. left:0,}])
  223. resize_thumbs_proto($(".ic6"),[
  224. {
  225. width:dim_hd.width,
  226. height:h5 + 10,
  227. // top:h54 - (hm) * .5,
  228. // left:0,
  229. // left:w54,
  230. // right:0,
  231. "--vtext":`"bottom_fs"`,
  232. data:{fs_type: "horizontal"},
  233. },overflow_obj])
  234. resize_thumbs_proto($(".ic4"),[
  235. {
  236. // height:h53,
  237. width:s_width,
  238. // height:h53,
  239. height:h_height,
  240. top:vtop - 1,
  241. left:vleft,
  242. // left:w54,
  243. // right:0,
  244. "--vtext":`"center"`,
  245. data:{fs_type: "single"},
  246. },])
  247. var center_vid = $(".ic4")[0]
  248. var bcr = center_vid.getBoundingClientRect()
  249. var bcr_fs = $(".fs_container")[0].getBoundingClientRect()
  250. glob_mx.dims.top_margin_flag=top_margin_flag
  251. glob_mx.dims.top_offset=bcr_fs.y
  252. glob_mx.dims.left_offset=bcr_fs.x
  253. if (glob_mx.dims.fullframe){
  254. fullframe()
  255. }else if (top_margin_flag){
  256. resize_thumbs_proto($("#largeVideoContainer"),[
  257. {
  258. // height:h53,
  259. width:s_width - m,
  260. // height:h53,
  261. height:h_height - hm,
  262. // top:vtop - 2 + (hm * .5),
  263. transform: "translate(0%, -50%)",
  264. top:`calc(50% + ${Math.floor(hm * 1)}px)`,
  265. top:`calc(50% + ${Math.floor(hm * .7)}px)`,
  266. left:vleft + (.5 * m),
  267. position:"relative",
  268. // outline:"1px solid blue",
  269. outline:"",
  270. // "z-index":"10",
  271. // left:w54,
  272. // right:0,
  273. "--vtext":`"center"`,
  274. data:{fs_type: "single"},
  275. },])
  276. } else {
  277. resize_thumbs_proto($("#largeVideoContainer"),[
  278. {
  279. // height:h53,
  280. width:s_width - m,
  281. // height:h53,
  282. height:h_height - hm,
  283. top:vtop - 2 + (hm * .5) + bcr_fs.y,
  284. // top:h5 + (3 * hm),
  285. transform: "translate(-50%, 0)",
  286. // top:`calc(50% + ${Math.floor(hm * 1)}px)`,
  287. // top:`calc(50% + ${Math.floor(hm * .7)}px)`,
  288. // left:vleft + (.5 * m),
  289. left:"50%",
  290. position:"relative",
  291. // "z-index":"10",
  292. // left:w54,
  293. // right:0,
  294. // outline:"1px solid red",
  295. outline:"",
  296. "--vtext":`"center"`,
  297. data:{fs_type: "single"},
  298. },])
  299. }
  300. // #sharedVideo
  301. // resize_thumbs_proto($(".ic4"),[
  302. resize_thumbs_proto($("#sharedVideoIFrame.z"),[
  303. {
  304. // height:h53,
  305. width:s_width,
  306. // height:h53,
  307. height:h_height,
  308. top:vtop - 1,
  309. left:vleft,
  310. position:"relative",
  311. // "z-index":"10",
  312. // left:w54,
  313. // right:0,
  314. "--vtext":`"center"`,
  315. data:{fs_type: "single"},
  316. },])
  317. resize_thumbs_proto($("#sharedVideoIFrame"),{
  318. position:"",
  319. })
  320. clog("top",top_margin_flag)
  321. resize_thumbs_proto($("#largeVideoContainer.z,#sharedVideoIFrame"),{position:"",})
  322. }
  323. function fullframe(){
  324. var w,h
  325. w = glob_mx.dims.fw
  326. h = glob_mx.dims.fh
  327. let top = "50%"
  328. let transform ="translate(-50%, -50%)"
  329. if (glob_mx.dims.top_margin_flag){
  330. top = glob_mx.dims.top_offset+ "px"
  331. transform = "translate(-50%, 0px)"
  332. transform = "translate(0%, 0px)"
  333. glob_mx.dims.top_offset
  334. // left_offset
  335. }
  336. resize_thumbs_proto($("#largeVideoContainer"),[
  337. {
  338. // height:h53,
  339. width:w,
  340. // height:h53,
  341. height: h,
  342. // top:vtop - 2 + (hm * .5) + bcr_fs.y,
  343. // top:h5 + (3 * hm),
  344. // transform: "translate(-50%, 0)",
  345. // transform: "translate(-50%, -50%)",
  346. // top:`calc(50% + ${Math.floor(hm * 1)}px)`,
  347. // top:`calc(50% + ${Math.floor(hm * .7)}px)`,
  348. // left:vleft + (.5 * m),
  349. // left:"50%",
  350. transform:"",
  351. // top:`50% ${glob_mx.dims.top_offset}`,
  352. top:`calc(50% + ${top}px)`,
  353. top:glob_mx.dims.top_offset,
  354. left:glob_mx.dims.left_offset,
  355. position:"relative",
  356. // "z-index":"10",
  357. // left:w54,
  358. // right:0,
  359. // outline:"1px solid red",
  360. outline:"",
  361. "--vtext":`"center"`,
  362. data:{fs_type: "single"},
  363. },])
  364. }
  365. // fullframe()
  366. // setTimeout(fullframe,100)
  367. function filmstrip_rs(){
  368. calc_fs_dims()
  369. clog("filmstrip_rs")
  370. }
  371. glob_mx.filmstrip_handlers.vertical = filmstrip_rs
  372. glob_mx.filmstrip_handlers.horizontal = filmstrip_rs
  373. glob_mx.filmstrip_handlers.center = filmstrip_rs
  374. glob_mx.filmstrip_tile_handlers.vertical = resize_thumbs_vertical
  375. glob_mx.filmstrip_tile_handlers.horizontal = resize_thumbs_horizontal
  376. glob_mx.filmstrip_tile_handlers.center = resize_thumbs_center
  377. // this handles sorting the videos
  378. function sort_id3(a, b) {
  379. if (a.id > b.id){
  380. return 1
  381. } else if (a.id < b.id){
  382. return -1
  383. }
  384. return 0
  385. }
  386. indexed_tiles = []
  387. indexed_map = window.indexed_map || new Map()
  388. reverse_indexed_map = window.reverse_indexed_map || new Map()
  389. // indexed_map = new Map()
  390. // reverse_indexed_map = new Map()
  391. function array_move(arr, old_index, new_index) {
  392. if (new_index >= arr.length) {
  393. var k = new_index - arr.length + 1;
  394. while (k--) {
  395. arr.push(undefined);
  396. }
  397. }
  398. arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
  399. return arr; // for testing
  400. };
  401. function mod_sort(){
  402. var arr = []
  403. var parr = []
  404. var ivid = {}
  405. var k,v
  406. var j = $(".small_vid:not(.pseudo_vid)")
  407. window.indexed_map = new Map()
  408. window.reverse_indexed_map = new Map()
  409. var part = get_participants()
  410. var parts =jc(part).sort(sort_id3)
  411. // clog(parts,part)
  412. var mod_id = get_mod(part)
  413. if (mod_id){
  414. remap_set( $(`#participant_${mod_id.id}`)[0],2)
  415. }
  416. var n
  417. var cnt = 0
  418. for (k of parts){
  419. // clog("z",k,k.local)
  420. if (k.isFakeParticipant){
  421. n = `<span class="plugin_top pseudo_vid small_vid youtube_vid"><div class="m2 xbox2">ABC</div></span>`
  422. if ($(".youtube_vid").length){
  423. } else {
  424. // html_hooks.create_video_tile(n)
  425. }
  426. // remap_set($(".youtube_vid")[0],0)
  427. j = $("#sharedVideoContainer")
  428. remap_set(j[0],2)
  429. // remap_set( $(`#participant_${mod_id.id}`)[0],1)
  430. } else {
  431. j = k.local ? $("#localVideoContainer") : $(`#participant_${k.id}`)
  432. // get_mod().id
  433. }
  434. j.css({"--v_index":`"I: ${cnt}"`})
  435. j.css({"--v_id":`"${k.id}"`})
  436. j[0].dataset.v_index = cnt
  437. arr.push(j[0])
  438. cnt += 1
  439. }
  440. v = $(".pseudo_vid")
  441. for (k of v){
  442. // clog(k)
  443. $(k).css({"--v_index":`"I: ${cnt}"`})
  444. $(k).css({"--v_id":`"pseudo_${cnt}"`})
  445. parr.push(k)
  446. $(k)[0].dataset.v_index = cnt
  447. cnt += 1
  448. }
  449. arr.push(...parr)
  450. window.arig_tiles = jc(arr)
  451. // remap_set($(".local_vid")[0],1)
  452. remap_set($(".local_vid")[0],3)
  453. // remap_set( $(`#participant_${mod_id.id}`)[0],2)
  454. arr = remap_sort(arr)
  455. arr = remap_sort(arr)
  456. arr = remap_sort(arr)
  457. window.sorted_tiles = arr
  458. // for
  459. }
  460. sorted_tiles = window.sorted_tiles || []
  461. function remap_sort(arr){
  462. // return
  463. var k,v
  464. for ([k,v] of indexed_map){
  465. // clog(k,v)
  466. var old_index = arr.indexOf(k)
  467. // clog("K,v",k,v,old_index)
  468. array_move(arr,old_index,v)
  469. // clog(cnt,sorted_tiles.includes(k),v,k)
  470. // cnt += 1
  471. }
  472. return arr
  473. }
  474. function remap_set(vid,loc){
  475. if (typeof(vid)=="number"){
  476. vid = sorted_tiles[vid]
  477. }
  478. var old = reverse_indexed_map.get(loc)
  479. // reverse_indexed_map
  480. indexed_map.delete(old,loc)
  481. indexed_map.set(vid,loc)
  482. reverse_indexed_map.set(loc,vid)
  483. var k,v
  484. var cnt = 0
  485. for ([k,v] of indexed_map){
  486. // clog(k,v)
  487. // clog(cnt,sorted_tiles.includes(k),v,k)
  488. cnt += 1
  489. }
  490. }
  491. // move videos onto the filmstrips
  492. function new_move(){
  493. var j
  494. try {
  495. j = jc(window.sorted_tiles)
  496. } catch (err) {
  497. clog("NEW MOVE err:",err)
  498. }
  499. $(".ic1").append(j.splice(0,5))
  500. // $(".ic2").append(j.splice(0,3))
  501. // $(".ic3").append(j.splice(0,3))
  502. $(".ic2").append(j.splice(0,1))
  503. $(".ic3").append(j.splice(0,1))
  504. $(".ic2").append(j.splice(0,1))
  505. $(".ic3").append(j.splice(0,1))
  506. $(".ic2").append(j.splice(0,1))
  507. $(".ic3").append(j.splice(0,1))
  508. const all_extra = j.splice(0)
  509. if (all_extra.length > 5){
  510. $(".ic6").addClass("overflow")
  511. } else {
  512. $(".ic6").removeClass("overflow")
  513. }
  514. $(".ic6").append(all_extra)
  515. }
  516. // the rest of this slides the bottom row if there is overflow.
  517. timeout_scroll_glob = window.timeout_scroll_glob || {
  518. stop:1,
  519. timeout:3000,
  520. rid:0,
  521. mx_raf:200,
  522. to_left:1,
  523. }
  524. timeout_scroll_glob.stop=1
  525. function timeout_scroll(rid){
  526. // clog("Tscroll",rid,timeout_scroll_glob)
  527. if (timeout_scroll_glob.stop || rid != timeout_scroll_glob.rid){
  528. // clog("tscroll stop")
  529. return
  530. }
  531. // clog("tscroll continue")
  532. scroll_send()
  533. var t = setTimeout(timeout_scroll,timeout_scroll_glob.timeout,rid)
  534. }
  535. function timeout_scroll_start(){
  536. timeout_scroll_glob.rid += 1
  537. setTimeout(timeout_scroll,timeout_scroll_glob.timeout,timeout_scroll_glob.rid)
  538. }
  539. function get_bcrs(arr,fs_bcr){
  540. var ret = {
  541. arr:[],
  542. first_left:0,
  543. first_left_bcr:0,
  544. first_right:0,
  545. first_right_bcr:0,
  546. }
  547. var s = $(".ic6").children(".small_vid")
  548. s.removeClass("ir il ilr ir0 il0")
  549. var k,v,bcr,isleft,isright
  550. for (v of arr){
  551. bcr = v.getBoundingClientRect()
  552. ret.arr.push(bcr)
  553. isleft = bcr.right < (fs_bcr.right + 10)
  554. isright = bcr.left > (fs_bcr.left )
  555. if (isleft && isright){
  556. $(v).addClass("ilr")
  557. } else if (isleft){
  558. $(v).addClass("il")
  559. } else if (isright){
  560. $(v).addClass("ir")
  561. }
  562. if (isleft && ! isright){
  563. ret.first_left = v
  564. ret.first_left_bcr = bcr
  565. }
  566. if ( (! ret.first_right ) && !isleft && isright ){
  567. ret.first_right = v
  568. ret.first_right_bcr = bcr
  569. }
  570. }
  571. clog("````",ret)
  572. $(ret.first_right).addClass("ir0")
  573. $(ret.first_left).addClass("il0")
  574. return ret
  575. }
  576. function scroll_to(n){
  577. var fs,fs_bcr,vid_bcr,ifs
  578. fs = $(".c6")[0]
  579. ifs = $(".ic6")[0]
  580. var vid
  581. var s = $(".ic6").children(".small_vid")
  582. fs_bcr = fs.getBoundingClientRect()
  583. var ov = get_bcrs([...s],fs_bcr)
  584. var tobj = {
  585. }
  586. var scroll_to_vid = 0
  587. if (timeout_scroll_glob.to_left){
  588. if (ov.first_left){
  589. scroll_to_vid = ov.first_left
  590. vid_bcr = ov.first_left_bcr
  591. tobj.inc_mx = vid_bcr.left - fs_bcr.left
  592. tobj.inc = -8
  593. } else {
  594. timeout_scroll_glob.to_left = 0
  595. }
  596. } else {
  597. if (ov.first_right){
  598. scroll_to_vid = ov.first_right
  599. vid_bcr = ov.first_right_bcr
  600. tobj.inc_mx = vid_bcr.right - fs_bcr.right
  601. tobj.inc = 8
  602. } else {
  603. timeout_scroll_glob.to_left = 1
  604. }
  605. }
  606. scroll_to_vid ? requestAnimationFrame(raf.bind(timeout_scroll_glob,fs,scroll_to_vid,tobj.inc,tobj.inc_mx,0,0),"z-index") : 0
  607. }
  608. function raf_clog(fs,vid,cnt,ts){
  609. clog("raf.",cnt,ts)
  610. }
  611. function raf(fs,vid,inc,inc_mx,cnt,ts0,ts){
  612. fs.scrollBy(inc,0)
  613. if (Math.abs(inc) < Math.abs(inc_mx) && cnt < timeout_scroll_glob.mx_raf && ts - (ts0 || ts) < 3000){
  614. requestAnimationFrame(raf.bind(timeout_scroll_glob,fs,vid,inc,inc_mx - inc ,cnt+1,ts0 || ts))
  615. } else {
  616. // clog("FIN",[fs,vid],cnt,ts0,inc_mx,ts,ts-ts0)
  617. vid.scrollIntoView({ behavior: 'smooth', block: 'nearest' ,inline:"nearest"})
  618. }
  619. }
  620. if (window.refresh_fs_proc){
  621. refresh_fs_proc()
  622. }
  623. // $(".video-stream.html5-main-video").play()
  624. // $(".video-stream.html5-main-video").play()
  625. // if ()