|
Help with flash player displaying title artist
Hi I need some help with a code for my flash player. It displays the artist and the song on one line. I would like it to be displayed separately .
Artist
Song
. Since there are four lines on the code for displaying song information, I could just replace one line in the code “URL” and have it replaced with the song item. If there is someone that could take a look at the code and assist me I will really appreciate it .
Thanks
Eliott
var nc:NetConnection = null;
var nsPlay:NetStream = null;
var metaDataValues:Array = new Array();
function initialize()
{
_root.connect.streamStr.text = "http://71.?????????????/";
_root.connect.connectStr.text = "rtmp://71????????????/restream/";
_root.connect.connectButton.onPress = _root.doConnect;
_root.connect.connectButton2.onPress = _root.doConnect;
//enablePlayControls(false);
metaDataValues["title"] = "";
metaDataValues["genre"] = "";
metaDataValues["name"] = "";
metaDataValues["url"] = "";
doConnect();
trace(System.capabilities.version);
}
function updateMetaData()
{
var metaStr = "";
var colortitulo = "#d00005";
var colortexto = "#0033CA";
if (metaDataValues["title"] != "")
metaStr += "<b><font size='13' color='"+colortitulo+"'>Canción: </font></b><font color='"+colortexto+"'>"+metaDataValues["title"]+"</font>\n";
var texto="";
texto+= metaDataValues["title"];
texto1.text =texto;
if (metaDataValues["genre"] != "")
metaStr += "<b><font size='13' color='"+colortitulo+"'>Genero: </font></b><font color='"+colortexto+"'>"+metaDataValues["genre"]+"</font>\n";
if (metaDataValues["name"] != "")
metaStr += "<b><font size='13' color='"+colortitulo+"'>Emisora: </font></b><font color='"+colortexto+"'>"+metaDataValues["name"]+"</font>\n";
if (metaDataValues["url"] != "")
metaStr += "<b><font size='13' color='"+colortitulo+"'>URL: </font></b><font color='"+colortexto+"'>"+metaDataValues["url"]+"</font>\n";
metaDataText.text = metaStr;
texto1.html = true;
texto1.htmlText = metaStr;
}
function doConnect()
{
// connect to the Wowza Media Server
if (nc == null)
{
// create a connection to the wowza media server
nc = new NetConnection();
// get status information from the NetConnection object
nc.onStatus = function(infoObject)
{
trace("nc: "+infoObject.code+" ("+infoObject.description+")");
if (infoObject.code == "NetConnection.Connect.Success")
playShoutcast();
}
nc.connect(_root.connect.connectStr.text);
enablePlayControls(true);
}
else
{
if (nsPlay != null)
{
nsPlay.attachVideo(null);
nsPlay.attachAudio(null);
}
nsPlay = null;
nc.close();
nc = null;
metaDataValues["title"] = "";
metaDataValues["genre"] = "";
metaDataValues["name"] = "";
metaDataValues["url"] = "";
updateMetaData();
enablePlayControls(false);
}
}
function enablePlayControls(isEnable:Boolean)
{
}
function playShoutcast()
{
// create a new NetStream object for video playback
nsPlay = new NetStream(nc);
// trace the NetStream status information
nsPlay.onStatus = function(infoObject)
{
trace("nsPlay: "+infoObject.code+" ("+infoObject.description+")");
}
nsPlay.onHeaderData = function(infoObject:Object)
{
trace("onHeaderData");
// print debug information about the metaData
for (var propName:String in infoObject)
{
trace(" "+propName + " = " + infoObject[propName]);
}
if (infoObject["icy-genre"] != undefined)
metaDataValues["genre"] = infoObject["icy-genre"];
if (infoObject["icy-name"] != undefined)
metaDataValues["name"] = infoObject["icy-name"];
updateMetaData();
}
nsPlay.onMetaData = function(infoObject:Object)
{
trace("onMetaData");
// print debug information about the metaData
for (var propName:String in infoObject)
{
trace(" "+propName + " = " + infoObject[propName]);
}
if (infoObject["StreamTitle"] != undefined)
metaDataValues["title"] = infoObject["StreamTitle"];
if (infoObject["StreamUrl"] != undefined)
metaDataValues["url"] = infoObject["StreamUrl"];
updateMetaData();
}
// set the buffer time to zero since it is chat
nsPlay.setBufferTime(10);
// subscribe to the named stream
nsPlay.play(_root.connect.streamStr.text);
// attach to the stream
soundRemote.attachAudio(nsPlay);
}
Stage.align = "TL";
Stage.scaleMode = "noScale";
_global.style.setStyle("backgroundColor","0xFFCC00 ");
initialize();
|