1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-08-03 17:09:00 +02:00
parent 9a29e35e64
commit cac2b97954
4 changed files with 338 additions and 360 deletions

View file

@ -622,7 +622,7 @@ local function extractVideoId(url)
return nil
end
-- Aktualisiere die PlayMusic Funktion
-- Aktualisierte PlayMusic Funktion
function PlayMusic(title, url, volume)
if not title or not url then
lib.notify({
@ -633,29 +633,31 @@ function PlayMusic(title, url, volume)
return
end
-- Bereinige YouTube URL
local cleanedUrl = cleanYouTubeUrl(url)
local videoId = extractVideoId(cleanedUrl)
if videoId then
-- Bereinige URL von Playlist-Parametern
local cleanUrl = url
if string.find(url, "youtube") then
cleanUrl = string.gsub(url, "&list=.-$", "")
cleanUrl = string.gsub(cleanUrl, "&start_radio=.-$", "")
cleanUrl = string.gsub(cleanUrl, "&index=.-$", "")
lib.notify({
title = 'DJ System',
description = 'YouTube Video wird geladen: ' .. title,
description = 'YouTube Video wird gestreamt: ' .. title,
type = 'info'
})
print('[DJ System] YouTube Video ID: ' .. videoId)
print('[DJ System] Bereinigte URL: ' .. cleanedUrl)
end
print('[DJ System] Streaming: ' .. title .. ' | Clean URL: ' .. cleanUrl)
-- Sende an Server
TriggerServerEvent('dj:playMusic', title, cleanedUrl, volume or 50)
TriggerServerEvent('dj:playMusic', title, cleanUrl, volume or 50)
-- Update lokale Variablen
isPlaying = true
currentSong = {
title = title,
url = cleanedUrl,
url = cleanUrl,
volume = volume or 50
}
end