So I’ve made a simple video player workaround, where instead of uploading a video, i upload a spritesheet and an audio. This is how it looks:
(i know it feels like i’m watching a cinema)
this system is completely cleint-sided
how can I make it so the video’s at the same time for everyone, while not making the whole system completely server-sided, so your fps isn’t dependent on ping? like watching a youtube livestream, everybody sees about the same frames delayed to to their connection or something. thanks!
here is the current script for this:
local Gui = script.Parent
local SpriteSheet = Gui:WaitForChild("SpriteSheet")
local VideoSound = Gui:WaitForChild("VideoSound")
local ContentProvider = game:GetService("ContentProvider")
local TweenService = game:GetService("TweenService")
local function PlayVideo(VideoName: string, SpriteSheet: string, Audio: string, SpriteSheetSize: Vector2, HorizontalFrameCount: number, VerticalFrameCount: number, TotalFrameCount: number, FrameRate: number, Subtext: string)
local Gui = script.Parent
local SpriteSheetInstance = Gui:WaitForChild("SpriteSheet")
local VideoSoundInstance = Gui:WaitForChild("VideoSound")
local VideoMenuInstance = Gui:WaitForChild("VideoMenu")
VideoMenuInstance.GroupTransparency = 1
VideoMenuInstance.AnchorPoint = Vector2.new(0.5, 0)
VideoMenuInstance.Title.Text = "Loading"
VideoMenuInstance.Title.Author.Text = "..."
local success, err = pcall(function()
ContentProvider:PreloadAsync({
SpriteSheet,
Audio
})
end)
if not success then
warn("Failed to load assets: " .. err)
return
end
SpriteSheetInstance.Image = SpriteSheet
VideoSoundInstance.SoundId = Audio
local FRAME_SIZE = Vector2.new(
SpriteSheetSize.X / HorizontalFrameCount,
SpriteSheetSize.Y / VerticalFrameCount
)
local currentFrame = 1
VideoMenuInstance.Title.Text = VideoName
VideoMenuInstance.Title.Author.Text = Subtext
VideoSoundInstance:Play()
task.spawn(function()
TweenService:Create(VideoMenuInstance, TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {GroupTransparency = 0, AnchorPoint = Vector2.new(0.5, 1)}):Play()
wait(1.5)
TweenService:Create(VideoMenuInstance, TweenInfo.new(.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.In), {GroupTransparency = 1, AnchorPoint = Vector2.new(0.5, 0)}):Play()
end)
for i = 1, TotalFrameCount do
local column = (currentFrame - 1) % HorizontalFrameCount
local row = math.floor((currentFrame - 1) / HorizontalFrameCount)
SpriteSheetInstance.ImageRectSize = FRAME_SIZE
SpriteSheetInstance.ImageRectOffset = Vector2.new(column * FRAME_SIZE.X, row * FRAME_SIZE.Y)
currentFrame = currentFrame + 1
wait(1 / FrameRate)
end
-- Stop the video
VideoSoundInstance:Stop()
SpriteSheetInstance.Image = ""
end
while true do
PlayVideo(
"Markiplier Moment",
"rbxassetid://123461840032880",
"rbxassetid://124035407806695",
Vector2.new(988, 1000),
10,
18,
176,
40,
"Markiplier, LynxWarlord Gaming"
)
PlayVideo(
"Eat a HORSE?!",
"rbxassetid://109096932005403",
"rbxassetid://109826360012529",
Vector2.new(979, 1000),
11,
20,
11 * 20,
30,
"satinden"
)
end