Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Give this one a shot will ya?
Old 03-01-2010, 01:36 AM Give this one a shot will ya?
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
I've got a bit of a problem, I'm trying to play MP3 files through the HTML 5 audio tags via iPhone's Mobile Safari:

HTML Code:
<audio src="http://domain.com/musicfile.mp3" controls="controls"></audio>
Ok, this works and all but only when it's a direct MP3 file. If I were to say, put it through a PHP script that outputs the selected file it wont work at all. I have tried various methods to get this to work(like the example listed below) and researched many forums and other sites with no luck.

PHP Code:
$file="test.mp3";
header("Content-type: application/octet-stream");
header("Content-disposition: inline; filename=\"$file\"");
header("Content-transfer-encoding: binary");
header("Content-length: " filesize($file));

$fp=fopen($file"r");
fpassthru($fp);
exit(); 
If you can help me, that would be awesome! Thanks in advance!
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
 
Register now for full access!
Old 03-01-2010, 03:53 AM Re: Give this one a shot will ya?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You will need to use
Code:
content-type="audio/mpeg"
otherwise the user agent will treat it as a binary file.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-01-2010, 12:51 PM Re: Give this one a shot will ya?
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Thanks for your prompt response, but I have already tried that. It seems that no matter what I try to do, the HTML 5 audio tags don't like when things go through scripts.

I'm not sure why because it works in Safari 4 flawlessly but once I try it on my iPhone the audio file does not load. Please note, I have successfully tested this with a direct stream to the file it's self.

Thanks again!
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 03-01-2010, 12:53 PM Re: Give this one a shot will ya?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
maybe the iPhone browser doesn't support HTML5 as yet.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-01-2010, 03:21 PM Re: Give this one a shot will ya?
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
I'm pretty sure it supports HTML 5. If I play it through a regular file(not through the php file) it works perfectly fine.

What I have found so far is that it might have something to do with the headers but I am not exactly sure what.
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 03-01-2010, 04:56 PM Re: Give this one a shot will ya?
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
I fixed and found the error my self, thanks anyways. For any who are experiencing the same problem try re-arranging the headers. I'm not sure why it mattered so much but apparently it did.
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Reply     « Reply to Give this one a shot will ya?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.01176 seconds with 12 queries