|
2 | 2 |
|
3 | 3 | // Tauri Plugins |
4 | 4 | import { path } from "@tauri-apps/api"; |
5 | | -import { getCurrentWindow } from "@tauri-apps/api/window" |
| 5 | +import { getCurrentWindow } from "@tauri-apps/api/window"; |
6 | 6 | import { BaseDirectory, exists, readTextFile } from "@tauri-apps/plugin-fs"; |
7 | 7 |
|
8 | 8 | // React Imports |
@@ -54,13 +54,14 @@ import check_internet_connection from "../../global/scripts/check_internet_conne |
54 | 54 | import rephrase_local_hls from "../scripts/rephrase_local_hls"; |
55 | 55 | import open_external from "../scripts/open_external"; |
56 | 56 | import { get_source_info } from "../../global/scripts/manage_extension"; |
| 57 | +import { read_config } from "../../global/scripts/manage_config"; |
57 | 58 |
|
58 | 59 | const FETCH_UPDATE_INTERVAL = 6; // In hours |
59 | 60 | let FIRST_RUN_TIMEOUT:any; |
60 | 61 |
|
61 | 62 | function Watch() { |
62 | 63 | const navigate = useNavigate(); |
63 | | - const {app_ready} = useContext<any>(global_context); |
| 64 | + const {app_ready, set_feedback_snackbar} = useContext<any>(global_context); |
64 | 65 |
|
65 | 66 | const { source_id, preview_id, season_id, watch_id }:any = useParams(); |
66 | 67 | console.log(season_id, watch_id); |
@@ -97,16 +98,20 @@ function Watch() { |
97 | 98 | useEffect(()=>{ |
98 | 99 | (async ()=>{ |
99 | 100 | if (isFullscreen){ |
100 | | - await getCurrentWindow().setFullscreen(true) |
101 | | - sessionStorage.setItem("fullscreen", "yes") |
| 101 | + sessionStorage.setItem("allow_auto_config_screen", "0"); |
102 | 102 | }else{ |
103 | | - await getCurrentWindow().setFullscreen(false) |
104 | | - sessionStorage.setItem("fullscreen", "no") |
| 103 | + sessionStorage.setItem("allow_auto_config_screen", "1"); |
| 104 | + const config = await read_config(); |
| 105 | + if (config.options.fullscreen){ |
| 106 | + await getCurrentWindow().setFullscreen(true); |
| 107 | + } |
| 108 | + |
105 | 109 | } |
106 | 110 | })(); |
107 | 111 | return; |
108 | 112 | },[isFullscreen]) |
109 | 113 |
|
| 114 | + |
110 | 115 | let update_state_interval:any = null; |
111 | 116 | let is_updating_state = false |
112 | 117 | useEffect(() => { |
@@ -441,50 +446,46 @@ function Watch() { |
441 | 446 | </div> |
442 | 447 | <div className={styles.body}> |
443 | 448 | <div className={styles.body_box_1}> |
444 | | - <div |
| 449 | + |
| 450 | + <MediaPlayer ref={media_player_ref} |
445 | 451 | style={{ |
| 452 | + boxSizing:"border-box", |
446 | 453 | flex:1, |
447 | 454 | minWidth:"200px", |
448 | 455 | display:"flex", |
449 | | - boxSizing:"border-box", |
450 | 456 | }} |
| 457 | + title={`Watching: ${preview_id}-${TYPE_SCHEMA=== 2 ? `Season ${SEASON_INDEX+1}-` : ""}Episode ${watch_id}`} |
| 458 | + onProviderChange={onProviderChange} |
| 459 | + src={MEDIA_SRC} |
| 460 | + onLoadedData={()=>{ |
| 461 | + set_is_media_ready(true); |
| 462 | + }} |
| 463 | + storage="vidstack" |
| 464 | + streamType='on-demand' |
| 465 | + viewType='video' |
| 466 | + playsInline crossOrigin |
451 | 467 | > |
452 | | - <MediaPlayer ref={media_player_ref} |
453 | | - style={{ |
454 | | - boxSizing:"border-box", |
455 | | - }} |
456 | | - title={`Watching: ${preview_id}-${TYPE_SCHEMA=== 2 ? `Season ${SEASON_INDEX+1}-` : ""}Episode ${watch_id}`} |
457 | | - onProviderChange={onProviderChange} |
458 | | - src={MEDIA_SRC} |
459 | | - onLoadedData={()=>{ |
460 | | - set_is_media_ready(true); |
461 | | - }} |
462 | | - storage="vidstack" |
463 | | - streamType='on-demand' |
464 | | - viewType='video' |
465 | | - playsInline crossOrigin |
466 | | - > |
467 | | - <MediaProvider> |
468 | | - {MEDIA_TRACK.map((track:any, index:any) => { |
469 | | - return ( |
470 | | - <track |
471 | | - key={index} |
472 | | - kind={track.kind} |
473 | | - src={MEDIA_TYPE === "local" ? convertFileSrc(track.url) : track.url} |
474 | | - srcLang={track.label} |
475 | | - label={track.label} |
476 | | - default={track.default} |
477 | | - |
478 | | - /> |
479 | | - ); |
480 | | - })} |
481 | | - </MediaProvider> |
482 | | - <DefaultVideoLayout |
483 | | - colorScheme="dark" |
484 | | - icons={defaultLayoutIcons} |
485 | | - /> |
486 | | - </MediaPlayer> |
487 | | - </div> |
| 468 | + <MediaProvider> |
| 469 | + {MEDIA_TRACK.map((track:any, index:any) => { |
| 470 | + return ( |
| 471 | + <track |
| 472 | + key={index} |
| 473 | + kind={track.kind} |
| 474 | + src={MEDIA_TYPE === "local" ? convertFileSrc(track.url) : track.url} |
| 475 | + srcLang={track.label} |
| 476 | + label={track.label} |
| 477 | + default={track.default} |
| 478 | + |
| 479 | + /> |
| 480 | + ); |
| 481 | + })} |
| 482 | + </MediaProvider> |
| 483 | + <DefaultVideoLayout |
| 484 | + colorScheme="dark" |
| 485 | + icons={defaultLayoutIcons} |
| 486 | + /> |
| 487 | + </MediaPlayer> |
| 488 | + |
488 | 489 | <div |
489 | 490 | style={{ |
490 | 491 | width:"auto", |
|
0 commit comments