简体   繁体   中英

PHP ZipArchive, play FLAC audio file which is inside a zip archive without extraction

It is about the following:

I like to play an audio file which is inside a zip archive without extraction.

This is my current approach:

<?
$z = new ZipArchive();
if ($z->open(dirname(__FILE__) . '/archiv.zip')) {
    $string = $z->getFromName("Part.flac");
}

?>

<audio src="?????" controls></audio>

The reading part works, but getFromName returns a string, the question is now how to convert the string back to it's 'binary flac format', so that the audio element can play it.

Any other better approach?

you can't do anything with any file inside a zip, you always have to extract it (even if just into memory).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM