Any reason not to just do a redirect?
I have a PHP script which serves up Quicktime files via RTSP to
desktop browsers. Since the iPhone doesn't do RTSP I check the user
agent at the top of the script and redirect the browser directly to
the quicktime file. I haven't tested with MP3 but I imagine it would
work.
if ((strstr($_SERVER['HTTP_USER_AGENT'], "iPhone")) or
(strstr($_SERVER['HTTP_USER_AGENT'], "iPod")))
{
$redirect = 'http://domain.tld/'. $_REQUEST['program'];
header("Location: $redirect");
}
(end the rest of the code follows, to generate the RTSP stuff for
desktop browsers)
On May 28, 10:48 pm, noflashlight <[EMAIL PROTECTED]> wrote:
> I've been tinkering with a new app, and I am trying to play an mp3 in
> Quicktime that is served from a PHP script.
>
> For example:http://myhost.com/mp3.php?token=12345&trackId=ABCDEF
>
> <?php
> //mp3.php
> $track = new Track($trackId, $token);
> if( $track->validateToken() ){
> //Spoof the headers
> header("HTTP/1.0 200 OK");
> header("Content-type: audio/mpeg");
> header("Content-Length: " . $track->getFilesize() );
> header("Content-Transfer-Encoding: binary");
> //Serve the bits
> echo file_get_contents($track->pathToFile, FILE_BINARY);}
>
> ?>
>
> Now this works just fine if I point my browser to it. Quicktime picks
> up the bits and starts playing it. But the iPhone browser just shows
> the QT logo with a line through it....
>
> I've tried changing the file extension from php to mp3, and using an
> htaccess file. Same problem.
> I've tried base64 encoding the url params <a href="http://
> forums.macrumors.com/showpost.php?p=5173576&postcount=4">as suggested
> here</a>. Same problem...
>
> I know this can be done.... Any ideas? I'm running out.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---