Music only plays for some players on gmod loading screen.
11 replies, posted
Does anyone have any idea why this is? The site works fine when its on internet explorer or firefox but, not on gmod. I have no idea why only a hand full of people can hear the music and others cant. Has anyone else had this problem? If so can you please tell me how you managed to solve it.
Thank you guys.
Don't have music in loading screen.
LMAO THATS FUNNY thanks for your help
You're welcome.
It would be easier to identify the issue if you posted the code you're using, <audio> tags? YouTube embed?
I can put the code its all java script the music files are on line too. I just thought it was weird that it only works on internet explorer and firefox. Just not in gmod but anyways here is the script.
[lua]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><?php include("include/title.txt"); ?></title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/background.js"></script>
<script type="text/javascript" src="js/music.js"></script>
<script type="text/javascript" src="js/timedmessage.js"></script>
</head>
<body onload="init();">
<div class="logo"><img src="<?php include("include/logo.txt"); ?>" /></div>
<div class="entry">
<center>
<b><div id="timedMsgDiv"></div></b>
</center>
</div>
<div class="entry">
<center>
<font size="2">
<center><b>Welcome to <?php include("include/communityname.txt"); ?>!</b></center>
<br />
<center><b><?php include("include/downloadmessage.txt"); ?></b></center>
<br />
<?php
$MapName = isset($_GET['mapname']) ? $_GET['mapname'] : false;
$Steam64 = isset($_GET['steamid']) ? $_GET['steamid'] : false;
$authserver = bcsub($Steam64, '76561197960265728') & 1;
$authid = (bcsub($Steam64, '76561197960265728')-$authserver)/2;
$USERSTEAM = "STEAM_0:{$authserver}:{$authid}";
$EndMessage = file_get_contents('include/endmessage.txt');
// echo "<center><b>Community ID: http://steamcommunity.com/profiles/{$Steam64}</b></center><br>";
echo "<center><b>Your SteamID: {$USERSTEAM}</b></center><br>";
echo "<center><b>Current map: {$MapName}</b></center><br>";
echo "<center><b>{$EndMessage}</center><br>";
?>
<center><b>Server Owner: <?php include("include/owner.txt"); ?></b></center>
</font>
</center>
</div>
<center><img src="images/loading.gif" /></center>
</body>
</html>
[/lua]
[lua]
var sound1="music/sound1.mp3"
var sound2="music/sound2.mp3"
var sound3="music/sound3.mp3"
var sound4="music/sound4.mp3"
var sound5="music/sound5.mp3"
var sound6="music/sound6.mp3"
var sound7="music/sound7.mp3"
var sound8="music/sound8.mp3"
var sound9="music/sound9.mp3"
var sound10="music/sound10.mp3"
/* This part could get confusing if you don't know what you're doing. */
var x=Math.round(Math.random()*9)
if (x==0) x=sound1
else if (x==1) x=sound2
else if (x==2) x=sound3
else if (x==3) x=sound4
else if (x==4) x=sound5
else if (x==5) x=sound6
else if (x==6) x=sound7
else if (x==7) x=sound8
else if (x==9) x=sound9
else x=sound10
if (navigator.appName=="Safari")
document.write('<bgsound src='+'"'+x+'"'+' loop="infinite">')
else
document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="0" height="0" autostart="true" loop="true">')
[/lua]
First, don't use audio in a loading screen. Every time I hear music in a loading screen I leave the server. Thankfully, good servers never have music in their loading screen.
Now, my guess for why the music isn't playing in GMod is that the script is detecting Safari for one of various reasons. The bgsound tag [URL="http://reference.sitepoint.com/html/bgsound"]only works in IE[/URL], so it's not playing anything.
If you [I]really[/I] want audio in your loading screen, convert the files to ogg and use an <audio> tag.
Okay that actually helped out a lot thank you. I also got it to work but I was using a few songs and now its annoying because it only would play the beginning of each song and so on. So I'll just make the loading screen as nice a possible without a sound. Thank you for your help. At least someone on here is informative.
Yeah I made this loading screen. I have a fix if you want it. Download [URL="http://www.run.performancegaming.net/downloads/loadingscreen_fix.rar"]here[/URL].
wow that's awesome! Thank you, wow nicest person I have ever met on here ha-ha. Thanks again and I see what you did, clever now I have to figure out how to convert music to that type of file.
[QUOTE=Thetomm2010;39987444]wow that's awesome! Thank you, wow nicest person I have ever met on here ha-ha. Thanks again and I see what you did, clever now I have to figure out how to convert music to that type of file.[/QUOTE]
No problem man. You can convert .mp3 to .ogg [URL="http://audio.online-convert.com/convert-to-ogg"]here[/URL]. :)
wow awesome!! Really appreciate it.
Sorry, you need to Log In to post a reply to this thread.