-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideoPlayer.lua
More file actions
30 lines (23 loc) · 869 Bytes
/
VideoPlayer.lua
File metadata and controls
30 lines (23 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- Replace MyClass with whatever class your interactable is set to.
function MyClass:client_onCreate()
self.gui = sm.regui.newBlank()
self.gui:setOnCloseCallback("cl_onGuiClose")
self.backPanel = self.gui:createWidget("BackPanel", "Widget", "BackgroundPopup")
self.backPanel:setPosition({ 0, 0 })
self.backPanel:setSize({ 1280 + 200, 720 + 200 })
self.image = self.backPanel:createWidget("Image", "ImageBox", "ImageBox")
self.image:setPosition({ 100, 100 })
self.image:setSize({ 1280, 720 })
self.player = sm.regui.video.createPlayer("Path/To/Video", self.image)
end
function MyClass:client_onInteract(_, state)
if not state then return end
self.gui:open()
self.player:play()
end
function MyClass:client_onFixedUpdate()
self.player:runFrame()
end
function MyClass:cl_onGuiClose()
self.player:stop()
end