I'm trying to create a QuickLook plugin to play audio from within a package for that package's QuickLook preview, but my attempts only display the default QL preview - a larger file icon, file name, type, size and modification date.
I've successfully displayed a test string as kUTTPlainText with my XCode setup for the targeted UTI type, and verified that the CFDataRef passed to QLPreviewRequestSetDataRepresentation isn't NULL.
Here is the basic code I've got inside my GeneratePreviewForURL
function:
NSURL *audioFilePath = @"the file path";
CFDataRef data = (__bridge CFDataRef)[NSData dataWithContentsOfURL:audioFilePath];
QLPreviewRequestSetDataRepresentation(preview, data, kUTTypeAudio, NULL);
return noErr;
Any ideas? Is playing audio from a QuickLook preview even possible?
I'm basing this answer on my personal experience.
With Xcode 4.2 on OSX 10.6.8 it was possible to load an audio file inside a HTML-based QuickLook plugin simply using the
<src>
attribute of the<audio>
tag:Now, with Xcode 5.1 on Mavericks, it seems that neither using the
cid:
scheme (I'll post an example below) does the job:I recon that you should report a bug to Apple for that!