Question

Experimentation reveals that in order to get GSM files to play in Quicktime on a windows box, the final redirect url has to end with .gsm. Unfortunately this is insufficient for the OSX system that the testers have, and attempting MIME types audio/gsm, audio/x-gsm, application/gsm, application/x-gsm, and application/x-GSM (desperate) does not work.

Proposed alternatives: Use http://www.westhawk.co.uk/software/playGSM/PlayGSM.html - but needs to be able to seek / display progress indicator. Transcode GSM files to MP3 files on the server, either before or when browser requests them, and use HTML5 audio player (+shim) to play them - but server admins uncomfortable with the load / storage use.

How can I convince the Quicktime browser plugin on OSX to play the file? Searching for documentation for the Quicktime browser plugin was not successful for me.

In a related note, the page at http://jquery.malsup.com/media/audio.html does load the GSM file provided, and the file when downloaded directly to the Mac does play correctly in Quicktime. The test Mac is running OSX 10.5.8.

Please find the embed code below:

$('#gsm_player').html('<object type="video/quicktime" data="'+
    event.target.href+'" width="300" height="20">'+
    '<param name="src" value="'+ event.target.href+'">'+
    '<param name="autoplay" value"true">'+
    '<p>QuickTime is required to listen to this file.'+
    '<a href="http://www.apple.com/quicktime/download/" '+
    'target="_blank">Download Here</a></p>'+
    '</object>'
);
Was it helpful?

Solution

I spoke with a tech support representative at Apple, who directed me to HTML Scripting Guide for QuickTime and JavaScript Scripting Guide for QuickTime for documentation.

I was able to solve my problem by turning off zlib.output_compression in PHP, and supplying the HTTP Content-Length header. I am not serving the file with a fake extension, but am using audio/x-gsm as the Content-Type header. Quicktime appears to be fine with or without the Content-disposition: attachment;... header. My files now play fine in OSX and Windows.

Worth note is the discussion at https://groups.google.com/forum/?fromgroups=#!topic/iphonewebdev/-5x2QNVCgII, particularly the mention of the source code at http://code.google.com/p/asterisk-voicemail-for-iphone/source/browse/trunk/iphone/i_functions.php#29. It contains one of the best 206 handlers I've seen, and put me on the right path and might be more helpful than doing exactly what worked for me (I didn't need the 206 handling, but you might).

Please find below the portion of the file downloader script which serves the file:

header('Content-Type: audio/x-gsm');
header("Content-disposition: attachment; filename=file.gsm");

ini_set("zlib.output_compression", "Off");
header("Content-Length: ".strlen($file));

echo $file;
exit;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top