Jump to content


Loading Music


  • You cannot reply to this topic
11 replies to this topic

#1 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 22 June 2007 - 08:25 AM

I have a music player that I just made and it will load the music from my site perfectly in Internet Explorer, but when I use FireFox it doesnt load at all. Can anybody tell me why?

#2 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 22 June 2007 - 08:28 AM

Is the audio on the same domain as the swf?

#3 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 27 June 2007 - 04:59 PM

Yes it is, but it is not in the same directory. It will load in internet explorer, but not Firefox.

#4 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 27 June 2007 - 05:46 PM

What are you using to load the audio? Code examples would be helpful.

Edited by Pax, 27 June 2007 - 05:46 PM.


#5 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 27 June 2007 - 07:41 PM

This is the entire code. It loads the music with the ID in the url.

file = "uploads/mp3_music/"+file_to_play;

MySound = new Sound();
MySound.loadSound(file, false);
_root.stat_bar.progress_mc._xscale = 0;
playin = false;
loaded = true;
step = 0;
pauses = false;
moving = false;
off = 0;
onEnterFrame = function () {
	percent = (MySound.getBytesLoaded()/MySound.getBytesTotal())*100;
	_root.stat_bar.progress_mc._xscale = percent;
	if (percent == 100 && playin == false && loaded == true) {
		MySound.start(0, 1);
		playin = true;
		loaded = false;
	}
	music_length = MySound.duration/1000;
	music_pos = MySound.position/1000;
	music_bar_len = _root.stat_bar.progress_mc._width;
	bar_percent = (music_pos/music_length)*100;
	if (moving == false) {
		_root.stat_bar.arrows._x = bar_percent*(music_bar_len/100);
	}
	if (pauses == false) {
		step = music_pos;
	}
	minutes = Math.floor(MySound.position/1000/60);
	seconds = Math.floor(MySound.position/1000)%60;
	band_song = author;
	if (title_song == undefined || title_song == "") {
		title_song = "Unknown Title";
	}
	if (band_song == undefined || band_song == "") {
		band_song = "Unknown Artist";
	}
	if (seconds<10) {
		seconds = "0"+seconds;
	}
	if (minutes<10) {
		minutes = "0"+minutes;
	}
	_root.display_txt.text = title_song+" / "+band_song+"  "+minutes+":"+seconds;
	if (percent<100) {
		_root.stat_bar.arrows.enabled = false;
		_root.volume_bar.dragger.enabled = false;
		pausebtn.enabled = false;
		playbtn.enabled = false;
		stopbtn.enabled = false;
		_root.stat_bar.arrows._alpha = 50;
		_root.volume_bar.dragger._alpha = 50;
		pausebtn._alpha = 50;
		playbtn._alpha = 50;
		stopbtn._alpha = 50;
	} else {
		_root.stat_bar.arrows.enabled = true;
		_root.volume_bar.dragger.enabled = true;
		pausebtn.enabled = true;
		playbtn.enabled = true;
		stopbtn.enabled = true;
		_root.volume_bar.dragger._alpha = 100;
		_root.stat_bar.arrows._alpha = 100;
		pausebtn._alpha = 100;
		playbtn._alpha = 100;
		stopbtn._alpha = 100;
	}
	if (moving == true) {
		off = (_root.stat_bar.arrows._x/_root.stat_bar.progress_mc._width)*music_length;
	}
};
_root.volume_bar.dragger.onPress = function() {
	startDrag(this, true, 0, this._y, _root.volume_bar.main._width, this._y);
	this.onEnterFrame = function() {
		var p = (this._x/_root.volume_bar.main._width)*100;
		MySound.setVolume(p);
	};
};
_root.volume_bar.dragger.onRelease = function() {
	stopDrag();
};
_root.volume_bar.dragger.onReleaseOutside = function() {
	stopDrag();
};
_root.stat_bar.arrows.onPress = function() {
	MySound.stop();
	startDrag(this, true, 0, this._y, _root.stat_bar.progress_mc._width, this._y);
	moving = true;
};
_root.stat_bar.arrows.onRelease = function() {
	stopDrag();
	MySound.start(off, 0);
	moving = false;
};
_root.stat_bar.arrows.onReleaseOutside = function() {
	stopDrag();
	moving = false;
	MySound.start(off, 0);
};
playbtn.onPress = function() {
	if (playin == false) {
		MySound.start(step, 1);
		playin = true;
		pauses = false;
	}
};
pausebtn.onPress = function() {
	if (playin == true) {
		MySound.stop();
		playin = false;
		pauses = true;
	}
};
stopbtn.onPress = function() {
	if (playin == true) {
		MySound.stop();
		playin = false;
		pauses = true;
		step = 0;
	}
};


#6 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 27 June 2007 - 09:23 PM

MySound = new Sound(this);

Try using that. It passes an object into the Sound Object to attach to. This can cause problems with playback. Do you have the mp3 player live yet? Might want to try adding a listenener to the loading of the sound object so you can make sure it loads properly.

#7 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 28 June 2007 - 02:10 PM

no that didnt work........is there any other thing that might be wrong? Here is the link to the page to open the player http://www.toon-workshop.net/portal/view.p...=music&id=1 click listen to music. Any guess what :biggrin: we live in the same city :)

Edited by Hip Hop Artist, 28 June 2007 - 02:11 PM.


#8 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 28 June 2007 - 04:59 PM

To be honest, neither one works for me. Whats the filesize on the mp3 you're trying to play? The swf doesn't even load in IE for me.

What part of Windsor are you in? How are your flash/graphic skills? The company I work for may be hiring right now if you've got some skill. http://www.mcgill.com

Edited by Pax, 28 June 2007 - 05:01 PM.


#9 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 28 June 2007 - 06:13 PM

I think I know the problem. Since it might take atleast 1 second to for the Flash file to start downloading the music file, you're percent variable might return 100 before the music has started to load, therefor MySound will have been instructed to start to play with no music, and will kinda mess everything up. I don't know how it worked for you in one browser or not, but try some debugging to see if what I said is the case.

#10 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 28 June 2007 - 08:59 PM

Thanks Ben, and Pax I live right near herman secondary. If you dont know where that is its right near the central mall. But my flash skills arent to good im better with web development and project management. I did call someone though, they said I might have the job because of my scripting knowledge.

#11 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 28 June 2007 - 09:13 PM

Ah cool, a couple of my friends live on the other side of Tecumseh from you (on Rossini). Small world. So you called McGill?

#12 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 28 June 2007 - 09:30 PM

well the number i got wasnt the same one as on the site, but i got the number from my buddy.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users