The question is really simple. I would like to emulate the behaviour of the default OSX's Audio QuickLook plugin, and I need the QuickTime Player which normally stays at the bottom of its preview window. I would also like that when my custom plugin is being used I can also hear the sound of the file I'm currently previewing.
Here is some code (from the GeneratePreviewForURL.m file) that might be useful to understand better the context:
OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options)
{
@autoreleasepool {
if (QLPreviewRequestIsCancelled(preview)) return noErr;
NSMutableString *html=[[NSMutableString alloc] init];
NSDictionary *props;
NSData *imageData=[NSData dataWithContentsOfFile:@"/tmp/IMAGE.png"];
props=@{
(__bridge NSString *)kQLPreviewPropertyTextEncodingNameKey:@"UTF-8",
(__bridge NSString *)kQLPreviewPropertyMIMETypeKey:@"text/html",
(__bridge NSString *)kQLPreviewPropertyAttachmentsKey:@{
@"IMAGE":@{
(__bridge NSString *)kQLPreviewPropertyMIMETypeKey:@"image/png",
(__bridge NSString *)kQLPreviewPropertyAttachmentDataKey: imageData,
},
},
};
[html appendString:@"<html>"];
[html appendString:@"<body>"];
[html appendString:@"<img src=\"cid:IMAGE\">"];
[html appendString:@"<br><br>"];
//...
[html appendString:@"</body>"];
[html appendString:@"</html>"];
QLPreviewRequestSetDataRepresentation(preview,(CFDataRef)[html dataUsingEncoding:NSUTF8StringEncoding],kUTTypeHTML,(CFDictionaryRef)props);
}
return noErr;
}