Tag Archive for mp3

MP3 Player

import er4d.util.Delegate;
import er4d.transitions.Tween;

class panik.PlayerMp3 extends MovieClip
{

private var play_btn:MovieClip;
private var pause_btn:MovieClip;
private var timeline:MovieClip;
private var timeline_bg:MovieClip;

private var songTrack:Sound;
private var loaded:Boolean;
private var	_src:String;

private var track_position:Number;
private var track_duration:Number;

private var loading_int:Number;
private var playing_int:Number;

function PlayerMp3()
{
loaded = false;
}

// INIT
public function set src(_src:String) {
this._src = _src;
loaded = false;
}
public function get isLoaded() {
return loaded;
}
public function loadMP3 (autoplay:Boolean) {
songTrack = new Sound();
songTrack.onLoad = Delegate.create(this, songLoaded, autoplay);
songTrack.loadSound(_src, true);
loaded = true;
loading_int = setInterval(this, "checkLoadingProgress", 100);
// CONTROL
timeline._width = 0;
play_btn.onPress = Delegate.create(this, startSound);
pause_btn.onPress = Delegate.create(this, stopSound);
if(autoplay) enablePlayBtn (false);
else enablePlayBtn (true);

}
// SOUND CONTROL
public function stopSound () {
songTrack.stop();
enablePlayBtn (true);
}
public function startSound (n:Number) {
// play
if (!n || songTrack.position == songTrack.duration) n = 0;
songTrack.start(n);
enablePlayBtn (false);
}

public function lock() {
this._x += 5000;
play_btn.enabled = pause_btn.enabled = false;
}
public function unlock() {
this._x -= 5000;
play_btn.enabled = pause_btn.enabled = true;
}

// PRIVATE

// watch song loading
private function checkLoadingProgress () {
var numBytesLoaded:Number = songTrack.getBytesLoaded();
var numBytesTotal:Number = songTrack.getBytesTotal();
var numPercentLoaded:Number = Math.floor(numBytesLoaded / numBytesTotal * 100);
}

// song loaded
private function songLoaded (autoplay:Boolean) {
// play stop
if(!autoplay) stopSound(); else
clearInterval(loading_int);
playing_int = setInterval(this, "checkPlayingProgress", 100);
track_duration = songTrack.duration/1000;
}
private function checkPlayingProgress () {
track_position = songTrack.position/1000;
var track_percent:Number = track_position / track_duration * 100;
if(songTrack.position == songTrack.duration) stopSound();
timeline._width = timeline_bg._width * track_percent / 100;
}

private function enablePlayBtn (b:Boolean){
if (b) {
Tween.prop(play_btn, "_alpha", 100);
play_btn.enabled = true;
Tween.prop(pause_btn, "_alpha", 30);
pause_btn.enabled = false;
} else {
Tween.prop(play_btn, "_alpha", 30);
play_btn.enabled = false;
Tween.prop(pause_btn, "_alpha", 100);
pause_btn.enabled = true;
}
}

}

source

Mp3 loader with seek

//***mp3 loader
_root.createEmptyMovieClip("seek",1)

seek.w=140		// seek bar width
seek.h=20		// seek bar height
seek.b=2		// seek bar border
seek.plc="0xff0000"	// seek bar preload color
seek.bgc="0x000000"	// seek bar background color
seek.fgc="0xffffff"	// seek bar foreground color

plw=seek.w-2*seek.b

MovieClip.prototype.drawSquare=function(w,h,l,t,c) {
with(this){
clear()
beginFill(c,100)
moveTo(l,t)
lineTo(l+w,t)
lineTo(l+w,t+h)
lineTo(l,t+h)
lineTo(l,t)
endFill()
}
return this
}

seek.jump=function() {
mp3.start((((seek.bg._xmouse-seek.b)/plw)*(mp3.duration/loaded))/1000)
}

seek.createEmptyMovieClip("bg",1).drawSquare(seek.w,seek.h,0,0,seek.bgc)
seek.createEmptyMovieClip("pl",2).drawSquare(1,seek.h-2*seek.b,0,seek.b,seek.plc)._x=seek.b
seek.createEmptyMovieClip("fg",3).drawSquare(1,seek.h-2*seek.b,0,seek.b,seek.fgc)._x=seek.b

mp3=new Sound()
mp3.loadSound("diggnation.mp3", true)
mp3.start(0)
seek.pl.onEnterFrame=function () {
out=loaded=mp3.getBytesLoaded()/mp3.getBytesTotal()
this._width=plw*loaded
seek.fg._width=out2=(mp3.position/(mp3.duration/loaded))*plw
}
seek.pl.onPress=function  () {
seek.jump()
this.onMouseMove=function () {
if (this.hitTest(_root._xmouse,_root._ymouse,false)){seek.jump()}
}
}
seek.pl.onRelease=seek.pl.onReleaseOutside=function  () {
delete this.onMouseMove
}

source

Streaming Mp3 Player using Flash Media Server 2

/*******************************
Import Classes
*******************************/
//Allow AS3 to talk to FMS2 AS1
NetConnection.defaultObjectEncoding = ObjectEncoding.AMF0;

/*******************************
Var
*******************************/
var rtmp:String = "rtmp://yourserver.com";
var songList:Array = new Array("You and I", "05 Phantom pt. I");
var nc:NetConnection = new NetConnection();
//	nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
var ns:NetStream;
var id3_ns:NetStream;
var nsClient:Object = new Object();
var id3Client:Object = new Object();
var isConnected:Boolean = false;
var currentSong:Number = 0;
var soundXForm:SoundTransform = new SoundTransform();
soundXForm.volume = 0.5;

/*******************************
Event Listeners
*******************************/
prev_btn.addEventListener(MouseEvent.CLICK, prevHandler);
next_btn.addEventListener(MouseEvent.CLICK, nextHandler);
play_mc.addEventListener(MouseEvent.CLICK, toggleButton);
play_mc.addEventListener(MouseEvent.CLICK, pauseHandler);

seekBar_mc.buttonMode = true;
seekBar_mc.addEventListener(MouseEvent.MOUSE_DOWN, seekStartDrag);

seekScrub_mc.buttonMode = true;
seekScrub_mc.addEventListener(MouseEvent.MOUSE_DOWN, seekStartDrag);

volScrub_mc.buttonMode = true;
volScrub_mc.scaleX = (volBar_mc.scaleX / 2);
volScrub_mc.addEventListener(MouseEvent.MOUSE_DOWN, volStartDrag);

volBar_mc.buttonMode = true;
volBar_mc.addEventListener(MouseEvent.MOUSE_DOWN, volStartDrag);

/*******************************
Event Handlers
*******************************/
function prevHandler(e:MouseEvent):void {
prevSong();
}
function pauseHandler(e:MouseEvent):void {
pauseSong();
}
function playHandler(e:MouseEvent):void {
//Play the song based on the position of the seekKnob
playSong(ns.time);
}
function nextHandler(e:MouseEvent):void {
nextSong();
}
function toggleButton(e:MouseEvent) {
//	trace(e.target.currentFrame);
//on - 1 :: onOver - 5 :: mute - 10 :: muteOver - 15
if (e.target.currentFrame == 1)
{
e.target.gotoAndStop(10);
} else if (e.target.currentFrame == 5)
{
e.target.gotoAndStop(15);
} else if (e.target.currentFrame == 10)
{
e.target.gotoAndStop(1);
} else if (e.target.currentFrame == 15)
{
e.target.gotoAndStop(5);
}
}
/*******************************
Connect to FMS and play song
*******************************/
//This Handles a Function call made by the Flash Media Server default main.asc
NetConnection.prototype.onBWDone = function(info) {}
NetConnection.prototype.onBWCheck = function() {}

function createConnection(appURL:String):void {
if( !nc.connected){
nc.connect(appURL);
nc.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler );
nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
}else{
nc.close();
isConnected = false;
}
}
function securityErrorHandler( e ):void{
trace("SecurityError: " + e);
}
//Detect when a connection has been made as well as the status of a playing song
function netStatusHandler( e:NetStatusEvent ):void {
switch( e.info.code ) {
case "NetConnection.Connect.Success":
connectionSuccess( new Event( "success" ) );
break;
case "NetConnection.Connect.Failed":
connectionFailed( new Event( "failed" ) );
break;
case "NetStream.Play.Stop":
//			trace("netStatusHandler:code: " + e.info.code);
break;
default:
//trace( "netStatusHandler:code: " + e.info.code );
break;
}
}
function connectionSuccess( e:Event ):void {
//A. Assign that a NetConnection has been made
isConnected = true;
//B. Assign a new NetStream connection
if( ns == null ){
ns = new NetStream(nc);
ns.addEventListener( AsyncErrorEvent.ASYNC_ERROR, catchAll );
ns.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler );
ns.addEventListener( IOErrorEvent.IO_ERROR, catchAll );
}
//C. Assign a new ID3 Netstream Connection
if( id3_ns == null ) {
id3_ns = new NetStream(nc);
id3_ns.addEventListener( AsyncErrorEvent.ASYNC_ERROR, catchAll );
id3_ns.addEventListener( IOErrorEvent.IO_ERROR, catchAll );
id3_ns.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler );
}
playSong(0);
}
function connectionFailed( e:Event ):void {
isConnected = false;
}
function catchAll( e:Event ){
trace("

Catch All: " + e + "

");
}

/*******************************
Single callback functions that process the information sent by FMS2
*******************************/
nsClient.onPlayStatus	= function( obj:Object ):void{
switch ( obj.code ){
case "NetStream.Play.Switch":
break;
case "NetStream.Play.Complete":
soundCompleteHandler();
break;
default:
for( var a:String in obj ){ trace(a + " " + obj[ a ]); }
break;
}
}
id3Client.onId3 = function( obj:Object ):void{
if(obj["artist"] != undefined){
text_txt.text = "Artist: " + obj["artist"].toString();
}
if(obj["songtitle"] != undefined){
text_txt.text += "
Title: " + obj["songtitle"].toString()
}
for( var b:String in obj ) {
//trace(b + ": " + obj[ b ]);
}
}
function setNetClientLength(length:Number):void{
nsClient.length = length;
}
/*******************************
Song
*******************************/
function prevSong():void {
//A. Close NetStream connection to allow for a new one
ns.close();
//B. If there is no previous song to play, restart the currentSong
if (currentSong > 0) {
currentSong--;
} else {
currentSong = songList.length - 1;
}
//C. Create a new Net Stream. The new Event is simply Fluff
connectionSuccess( new Event("Empty String"));
}
function nextSong():void {
//A. Close the NetStream connection to allow for a new one
ns.close();
//B. If there is another song in the playlist, play on!
if (currentSong < songList.length - 1) {
currentSong++;
}else {
//C. Otherwise return to the first song on the playlist
currentSong = 0;
}
//D. Create a new NetStream connection
connectionSuccess(new Event("Empty String"));
}
function playSong(position:Number):void {
text_txt.text = "";
//A. Ensure that the connection to FMS is open
if (!isConnected) { createConnection(rtmp); }
//B. Find the ID3 Information of the Mp3
id3_ns.play("id3:" + songList[currentSong]);
//C. Reassign the id3Client:Object to re-catch any ID3 info
id3_ns.client = id3Client;
//C. Play the new NetStream connection
//play(songName, postion in Seconds:Number, duration in seconds:Number, flush:Boolean -> false means play the next song)
ns.play("mp3:" + songList[currentSong], position);
//D. Reassign the nsClient:Object to ensure the catch of the onPlayStatus
ns.client = nsClient;
//E. Adjust the Volume
ns.soundTransform = soundXForm;
//E. Retreive the Length of the Song from FMS and set it to nsClient.length
nc.call("getStreamLength", new Responder(setNetClientLength), "mp3:" + songList[currentSong]);
//F. Begin tracking the position of the song for the status bar
seekBar_mc.addEventListener(Event.ENTER_FRAME, songPosition);
}
function pauseSong():void {
ns.togglePause();
}
function soundCompleteHandler():void {
trace("soundCompleteHandler");
//Garbage Collection
seekBar_mc.removeEventListener(Event.ENTER_FRAME, songPosition);
//This resets the Progress Bar back to 0
songPosition(new Event("Empty String"));
//Flip the Play/Pause button back to play
play_mc.gotoAndStop("play");
//Repeat the song
nextSong();
}
/*******************************
Volume
*******************************/
function volStartDrag(e:MouseEvent):void {
volumeUpdate(e);
volBar_mc.addEventListener(MouseEvent.MOUSE_MOVE, volumeUpdate);
volScrub_mc.addEventListener(MouseEvent.MOUSE_MOVE, volumeUpdate);
stage.addEventListener(MouseEvent.MOUSE_UP, volumeStopDrag);
}
function volumeStopDrag(e:MouseEvent):void {
volBar_mc.removeEventListener(MouseEvent.MOUSE_MOVE, volumeUpdate);
volScrub_mc.removeEventListener(MouseEvent.MOUSE_MOVE, volumeUpdate);
stage.removeEventListener(MouseEvent.MOUSE_UP, volumeStopDrag);
}
function volumeUpdate(e:MouseEvent):void{
//Calculate the Distance Between the Mouse (e.stageX) and the volBar_mc.x
var dist:Number = ((e.stageX - volBar_mc.x) / volBar_mc.width);
if (dist >= 0 && dist <= 1){
//Adjust the Volume Bar GUI
volumeBarUpdate(dist);
//Adjust the Sound Volume
soundXForm.volume = dist;
ns.soundTransform = soundXForm;
}
}
function volumeBarUpdate(dist:Number):void{
volScrub_mc.scaleX = (dist);
}
/*******************************
Seek
*******************************/
function seekStartDrag(e:MouseEvent):void {
//A. Jump to the spot in the song where the user clicked
seekUpdate(e);
//A. Remain seeking while the Mouse is Still Down and Moving
seekBar_mc.addEventListener(MouseEvent.MOUSE_MOVE, seekUpdate);
seekScrub_mc.addEventListener(MouseEvent.MOUSE_MOVE, seekUpdate);
//C. Self Destruct
stage.addEventListener(MouseEvent.MOUSE_UP, seekStopDrag);
}
function seekStopDrag(e:Event):void {
seekScrub_mc.removeEventListener(MouseEvent.MOUSE_MOVE, seekUpdate);
seekBar_mc.removeEventListener(MouseEvent.MOUSE_MOVE, seekUpdate);
stage.removeEventListener(MouseEvent.MOUSE_UP, seekStopDrag);
}
function seekUpdate(e:MouseEvent):void {
//A. If a user clicks a new part of the song, you must first seek() then update the Progress Bar
var dist:Number = ((e.stageX - seekBar_mc.x) / seekBar_mc.width);
//B. Seek the spot
ns.seek(Math.floor(nsClient.length * dist));
//C. Upate the Progress Bar
seekBarUpdate(dist)
}
function songPosition(e:Event):void{
var dist:Number = ns.time / nsClient.length;
if (!isNaN(dist)) {
seekBarUpdate(dist);
} else {
seekBarUpdate(0);
}
}
function seekBarUpdate(dist:Number){
//A. Adjust the GUI
seekScrub_mc.scaleX = dist;
}
/*******************************
Launch the Application on Frame(0)
*******************************/
addFrameScript(0, createConnection(rtmp));

source

MP3 checksum in ID3 tag

#!/usr/bin/python

"""mp3md5: MP3 checksums stored in ID3v2

mp3md5 calculates MD5 checksums for all MP3's on the command line
(either individual files, or directories which are recursively
processed).

Checksums are calculated by skipping the ID3v2 tag at the start of the
file and any ID3v1 tag at the end (does not however know about APEv2
tags).  The checksum is stored in an ID3v2 UFID (Unique File ID) frame
with owner 'md5' (the ID3v2 tag is created if necessary).

Usage: mp3md5.py [options] [files or directories]

-h/--help
Output this message and exit.

-l/--license
Output license terms for mp3md5 and exit.

-n/--nocheck
Do not check existing checksums (so no CONFIRMED or CHANGED lines
will be output). Causes --update to be ignored.

-r/--remove
Remove checksums, outputting REMOVED lines (outputs NOCHECKSUM for
files already without them).  Ignores --nocheck and --update.

-u/--update
Instead of printing changes, update the checksum aand output UPDATED
lines.

Depends on the eyeD3 module (http://eyeD3.nicfit.net)

Copyright 2007 G raham P oulter
"""

__copyright__ = "2007 G raham P oulter"
__author__ = "G raham P oulter"
__license__ = """This program is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>."""

import eyeD3
from getopt import getopt
import md5
import os
import struct
import sys

pretend = False # Whether to pretend to write tags
nocheck = False # Whether to not check existing sums
remove = False  # Whether to remove checksums
update = False  # Whether to update changed checksums

def log(head, body, *args):
"""Print a message to standard output"""
print head + " "*(12-len(head)) + (body % args)

def openTag(fpath):
"""Attempt to open ID3 tag, creating a new one if not present"""
if not eyeD3.tag.isMp3File(fpath):
raise ValueError("NOT AN MP3: %s" % fpath)
try:
audioFile = eyeD3.tag.Mp3AudioFile(fpath, eyeD3.ID3_V2)
except eyeD3.tag.InvalidAudioFormatException, ex:
raise ValueError("ERROR IN MP3: %s" % fpath)
tag = audioFile.getTag()
if tag is None:
tag = eyeD3.Tag(fpath)
tag.header.setVersion(eyeD3.ID3_V2_3)
if not pretend:
tag.update()
return tag

### WARNING: REMEMBER TO UPDATE THE COPY IN MD5DIR
def calculateUID(filepath):
"""Calculate MD5 for an MP3 excluding ID3v1 and ID3v2 tags if
present. See <a href="http://www.id3.org" >www.id3.org</a> for tag format specifications."""
f = open(filepath, "rb")
# Detect ID3v1 tag if present
finish = os.stat(filepath).st_size;
f.seek(-128, 2)
if f.read(3) == "TAG":
finish -= 128
# ID3 at the start marks ID3v2 tag (0-2)
f.seek(0)
start = f.tell()
if f.read(3) == "ID3":
# Bytes w major/minor version (3-4)
version = f.read(2)
# Flags byte (5)
flags = struct.unpack("B", f.read(1))[0]
# Flat bit 4 means footer is present (10 bytes)
footer = flags & (1<<4)
# Size of tag body synchsafe integer (6-9)
bs = struct.unpack("BBBB", f.read(4))
bodysize = (bs[0]<<21) + (bs[1]<<14) + (bs[2]<<7) + bs[3]
# Seek to end of ID3v2 tag
f.seek(bodysize, 1)
if footer:
f.seek(10, 1)
# Start of rest of the file
start = f.tell()
# Calculate MD5 using stuff between tags
f.seek(start)
h = md5.new()
h.update(f.read(finish-start))
f.close()
return h.hexdigest()

def readUID(fpath):
"""Read MD5 UID from ID3v2 tag of fpath."""
tag = openTag(fpath)
for x in tag.getUniqueFileIDs():
if x.owner_id == "md5":
return x.id
return None

def removeUID(fpath):
"""Remove MD5 UID from ID3v2 tag of fpath"""
tag = openTag(fpath)
todel = None
for i, x in enumerate(tag.frames):
if isinstance(x, eyeD3.frames.UniqueFileIDFrame)
and x.owner_id == "md5":
todel = i
break
if todel is not None:
del tag.frames[i]
if not pretend:
tag.update(eyeD3.ID3_V2_3)
return True
else:
return False

def writeUID(fpath, uid):
"""Write the MD5 UID in the ID3v2 tag of fpath."""
tag = openTag(fpath)
present = False
for x in tag.getUniqueFileIDs():
if x.owner_id == "md5":
present = True
x.id = uid
break
if not present:
tag.addUniqueFileID("md5", uid)
if not pretend:
tag.update(eyeD3.ID3_V2_3)

def mungeUID(fpath):
"Update the MD5 UID on the tag"""
if remove:
if removeUID(fpath):
log("REMOVED", fpath)
else:
log("NOCHECKSUM", fpath)
else:
cur_uid = readUID(fpath)
if cur_uid is None:
new_uid = calculateUID(fpath)
writeUID(fpath, new_uid)
log("ADDED", fpath)
elif not nocheck:
new_uid = calculateUID(fpath)
if cur_uid == new_uid:
log("CONFIRMED", fpath)
elif update:
writeUID(fpath, new_uid)
log("UPDATED", fpath)
else:
log("BROKEN", fpath)

if __name__ == "__main__":
optlist, args = getopt(sys.argv[1:], "hlnru", ["help","license","nocheck","remove","update"])
for key, value in optlist:
if key in ("-h","--help"):
print __doc__
sys.exit(0)
elif key in ("-l","--license"):
print license
sys.exit(0)
elif key in ("-n","--nocheck"):
nocheck = True
elif key in ("-r", "--remove"):
remove = True
elif key in ("-u", "--update"):
update = True
for start in args:
if os.path.isfile(start):
if start.endswith(".mp3"):
mungeUID(start)
elif os.path.isdir(start):
for root, dirs, files in os.walk(start):
dirs.sort()
files.sort()
for fname in files:
if fname.endswith(".mp3"):
mungeUID(os.path.join(root,fname))
else:
log("WARNING", "%s does not exist", start)

source

JW PLAYERS 3.9 – Exsample

<script type="text/javascript" src="swfobject.js"></script>
<div id="player3"><a href="http://www.macromedia.com/go/getflashplayer">Get Adobe Flash Player</a></div>
<script type="text/javascript">
var s3 = new SWFObject("mp3player.swf", "line", "240", "20", "7");
s3.addVariable("file","song1.mp3");
s3.addVariable("repeat","true");
s3.addVariable("showdigits","false");
s3.write("player3");
</script>

source

Bookmark file playing in xmms

//Removes the path $t from the nth playlist.
function _remove($n,$t)
{
$nazw="/bm".$n.".m3u";

$a=file_get_contents($nazw);
$b=strpos($a,$t);

if ($b === false) {;} else
{
$c=strpos($a,"
",$b);
$ha=fopen($nazw,"w+");
if ($b>0)
fwrite($ha,substr($a,0,$b));
fwrite($ha, substr($a,$c+1));
fclose($ha);
}
}

if ($argc!=2) die ("usage: ".$argv[0]." [0,1,2]
");
if (!in_array($argv[1], array('0','1','2') ))
die ("usage: ".$argv[0]." [0,1,2]
");
$n=(integer)$argv[1];

$blokada=fopen("/.bm.lock",'w');
if ($blokada == false)
die("error fopen
");
if (!flock($blokada,LOCK_EX))
die ("error flock
");

//get path to currently played track
$a=file_get_contents('/tmp/xmms-info');
$b=substr($a, 6+strpos($a,"File: "));
$b=substr($b,0,strlen($b)-1);

_remove(0,$b);
_remove(1,$b);
_remove(2,$b);

//add path to a file

$nazw="/bm".$n.".m3u";

$plik=fopen($nazw,'a');
fwrite($plik, $b."
");
fclose($plik);
fclose($blokada);

source

Locate and play mp3 files with given pattern in path

system('locate -i '+ARGV[0]+' >/locate.0');
iter=""
no=0
ARGV.each {
|iter|
system('grep -i </locate.'+no.to_s+' '+iter+' >/locate.'+(1-no).to_s);
no=1-no
}
system('grep </locate.'+no.to_s+' .mp3$ >/locate.tmp.m3u');
# system('dcop amarok playlist addMedia /locate.tmp.m3u');
system('xmms /locate.tmp.m3u');

source

Dynamically Load an MP3

/*************************
Initialize Variables
*************************/
var pos:Number;
var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume(75);

/*************************
Play Song
*************************/
function playSong(song:String){
s = new Sound();
s.onSoundComplete = playSong;
s.setVolume(75);
this.onEnterFrame = checkSound;
s.loadSound(song, true);
}
function checkSound(){
var percent:Number = Math.round((s.position / s.duration) * 100);
if(percent != NaN){
trace(percent);
}
}
/*************************
Pause Song (Create a Button that says play_btn.onRelease = pauseSong;)
*************************/
function pauseSong():Void{
pos = s.position;
s.stop();
}
function unpauseSong():Void{
s.start((pos/1000));
}

/*************************
onLoad
*************************/
playSong("http://www.somesite.com/file.mp3");

source