toMediaSource

actual fun PlatformFile.toMediaSource(): MediaSource(source)

Reads PlatformFile as video.

A picked file is a file or a content uri on Android, a file url on Apple and an object url in a browser, so each target returns the arm of MediaSource its export engine understands rather than flattening every one of them to a path.

actual fun PlatformFile.toMediaSource(): MediaSource(source)

Reads this file as video.

A URL the document picker returned is security-scoped and FileKit does not hold that scope open, so wrap the export in withScopedAccess or the backend opens nothing. A URL from the photo picker is a copy in the app's temporary directory and needs no scope.

expect fun PlatformFile.toMediaSource(): MediaSource(source)

Reads PlatformFile as video.

A picked file is a file or a content uri on Android, a file url on Apple and an object url in a browser, so each target returns the arm of MediaSource its export engine understands rather than flattening every one of them to a path.

actual fun PlatformFile.toMediaSource(): MediaSource(source)

Reads PlatformFile as video.

A picked file is a file or a content uri on Android, a file url on Apple and an object url in a browser, so each target returns the arm of MediaSource its export engine understands rather than flattening every one of them to a path.

actual fun PlatformFile.toMediaSource(): MediaSource(source)

Publishes this file as an object URL, which is the only handle WebCodecs reads.

Every call mints a new URL, so call it once per file and keep the result. The URL holds the picked file until release frees it or the page unloads.

Throws

on a picked directory, which has no bytes to read.