Discover & Rate New Music Check out ChartVote. Promote the music you like.

Flash Player 9.0.115.0 Sound Position Bug

I recently upgraded to flash player 9.0.115.0 and I’ve found that when “pausing” an mp3 and storing the song’s position when it was paused and then restarting the song with the position that was stored causes the song to play about 1.5 seconds ahead of where I stopped the song at? This was working fine with the previous version of flash. Anyone else experiencing this?

This bug manifests itself everywhere the new player version(9.0.115.0) is used including the Flash CS3 IDE, Internet Explorer and Firefox. I’ve done a quick search of the flash forums, but I have not seen anyone else with this issue.

I don’t think this is a browser issue since this bug is even reproduced in the actuall flash CS3 IDE. I believe this is an issue with the flash player itself.

Limit File Download Speed with PHP

This PHP code will limit the download rate for a file being downloaded by a client. This is useful if you are streaming MP3s from your site and you are trying to distribute your bandwidth as evenly as possible.

For example: If you are streaming MP3s with a bitrate of 96kb then you would at the minimum only need to send 12KB/s of data to the client. Now to be safe I would send around 16KB/s to allow some buffering just in case some packets get held up somewhere.

Code

PHP:
  1. <?php
  2.  
  3. $file = "/path/to/file/test.mp3"; // path to file
  4. $speed = 16; // 16 kb/s download rate limit
  5.  
  6. header("Cache-control: private");
  7. header("Content-Type: application/octet-stream");
  8. header("Content-Length: ".filesize($file));
  9. header("Content-Disposition: filename=$file" . "%20");
  10.  
  11.  
  12. $fd = fopen($file, "r");
  13. while(!feof($fd)) {
  14.     echo fread($fd, round($speed*1024));
  15.     flush();
  16.     sleep(1);
  17. }
  18.  
  19. fclose ($fd);
  20.  
  21. ?>

Download MP3s from MySpace with PHP

Disclaimer: This code is not meant to be used in any malicious way. Its only a proof of concept and should not be used to illegal download music. I am not responsible for any damages caused by this code. Use at your own risk.

Now that I got that out of the way...have at it.

How it works
With this PHP code you can specify the friendID of any artist on MySpace and it will download all the songs from the artist's profile. URLs to MP3s on MySpace have a one-time use token in them that only allows the URL to be used once, thus allowing the MP3 to be accessed only once per request. This script grabs all the parts needed to construct this URL with the token in it and grabs the MP3 like a normal browser would or like the song player on artist profiles.

This code is only a snippet of a MySpace crawler that I wrote that can spider and categorize MP3s on MySpace. My version is much more advanced in functionality so I am only posting the "meat" of the code here. Why? Because I am in a generous mood and plus its not exactly rocket science to do this.

The Code

PHP:
  1. <?php
  2.  
  3.     $artistid = 123456789;
  4.     $xmldata = file_get_contents("http://mediaservices.myspace.com/services/media/musicplayerxml.ashx?b=".$artistid);
  5.  
  6.     $xmlartist = simplexml_load_string($xmldata);
  7.  
  8.     echo "Artist: ".$xmlartist->name."<br>";
  9.     echo "Track Listing:<br>";
  10.  
  11.     foreach($xmlartist->playlist->song as $song) {
  12.  
  13.         $xmldata = file_get_contents("http://mediaservices.myspace.com/services/media/musicplayerxml.ashx?b=".$artistid."&s=".$song['bsid']);
  14.         $xmlsong = simplexml_load_string($xmldata);
  15.  
  16.         $temp = explode("?", $xmlsong->curl);
  17.         parse_str($temp[1], $urlinfo);
  18.  
  19.         $songurl = $xmlsong->durl."?bandid=".$urlinfo['bandid']."&songid=".$urlinfo['songid']."&token=".$xmlsong->token."&p=".$urlinfo['p']."&a=0";
  20.  
  21.         echo "Downloading: ".$song['bsid']."<br>";
  22.  
  23.         $mp3data = file_get_contents($songurl);
  24.         $f = fopen("/path/to/save/".$song['bsid'].".mp3", "w+");
  25.         fwrite($f, $mp3data);
  26.         fclose($f);
  27.  
  28.     }
  29.  
  30. ?>

Download: MySpace-MP3-Downloader.zip (1kb)

Indiefy Teaser

I have been quiet lately on here and I apologize for that, but I have good reason (well at least I think so). Indiefy is coming along nicely and I wanted to show off one of my favorite features of the site. The screenshot below is from the Arist Manager and shows the MP3 uploader in action. The uploader is built in flash and looks quiet sexy if you ask me. For those of you who don't know, flash has the capabilities to upload files to a web server. This gives you the ability to show a progress of the upload and gives the user a much more intuitive interface. That is one thing thats always bugged me about uploading files from a form, you never knew how much was left.


Screenshot
Indiefy Teaser

Flash loadSound auto-play bug in IE

I have a simple mp3 player that I have written in flash 8 that streams an MP3 file. The problem is this: When I view the player in IE and let the mp3 file completely download and reload the page, the sound does not auto-play like it should when using the loadSound() streaming option. This seems to be an issue with IE's cache. So far I have seen this issue in IE 6 and 7 on multiple machines when the cache is enabled. Firefox and flock work perfectly.

Follow these steps to recreate:
1. Go to http://www.findmotive.com/flashautostart/
2. Let the flash completely download the mp3 (You can tell by the green progress bar)
3. Refresh the page

When you refresh the page the green progress bar should show 100%, but it will not auto-play the MP3. To make it play you have to hit the pause/play button.

If I open the URL in a new window or tab then it will auto-play even when fetching the mp3 from the cache. Let me know if you have a solution to this. If I find the solution I will post it here.

RSS Feed



Recommended Sites