detectAudioMediaType
Identify an audio format from its bytes.
Sniffs the container from the leading bytes and returns a media type. Used
internally by transcribe when the declared
type is generic; exposed because it is useful on its own.
let mediaType = detectAudioMediaType(data) // "audio/mp4", "audio/wav", ...Signature
func detectAudioMediaType(
_ audio: Data
) -> String?Defined in Sources/AI/Core/Transcription.swift.
Parameters
| Parameter | Type | Default |
|---|---|---|
_ | Data | required |
Returns
A media type String, or nil when nothing matches.