File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed
cinema_modded/gamemode/modules/theater/services Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,17 @@ if (CLIENT) then
2121 end
2222
2323 function SERVICE :LoadProvider ( Video , panel )
24-
25- panel :OpenURL (playerURL (" youtube.html" ) ..
24+ local url = playerURL (" youtube_testing.html" ) ..
2625 (" ?v=%s" ):format (Video :Data ())
27- )
26+
27+ if self .IsTimed then
28+ local startTime = math.max (0 , math .Round (CurTime () - Video :StartTime ()))
29+ if startTime > 0 then
30+ url = url .. (" &t=%d" ):format (startTime )
31+ end
32+ end
33+
34+ panel :OpenURL (url )
2835
2936 panel .OnDocumentReady = function (pnl )
3037 self :LoadExFunctions ( pnl )
Original file line number Diff line number Diff line change 6565
6666 function onYouTubeIframeAPIReady ( ) {
6767 const vid = getUrlParameter ( 'v' ) || 'dQw4w9WgXcQ' ;
68+ const startTime = parseFloat ( getUrlParameter ( 't' ) ) || 0 ;
6869
69- createPlayer ( vid ) ;
70+ createPlayer ( vid , startTime ) ;
7071 }
7172
72- function createPlayer ( videoId ) {
73+ function createPlayer ( videoId , startTime ) {
7374 if ( player && typeof player . destroy === 'function' ) {
7475 player . destroy ( ) ;
7576 player = null ;
8081 height : '100%' ,
8182 width : '100%' ,
8283 videoId : videoId ,
83- playerVars : defaultPlayerVars ,
84+ playerVars : {
85+ ...defaultPlayerVars ,
86+ start : Math . floor ( startTime ) // YouTube API supports start parameter
87+ } ,
8488 host : 'https://www.youtube-nocookie.com' ,
8589 events : {
8690 onReady : ( ) => {
87- wrapper . _ready = true
91+ wrapper . _ready = true ;
92+
93+ // Additional seek if needed (for more precise timing)
94+ if ( startTime > 0 ) {
95+ player . seekTo ( startTime , true ) ;
96+ }
8897
8998 window . cinema_controller = wrapper ;
9099 exTheater . controllerReady ( ) ;
You can’t perform that action at this time.
0 commit comments