MediaContent

Represents different types of media content that can be attached to messages. Supports images, videos, audio files, and documents with base64 encoding capabilities.

Inheritors

Types

Link copied to clipboard
class Audio(val data: ByteArray, val format: String) : MediaContent

Represents audio content stored as byte array.

Link copied to clipboard
data class File(val source: String) : MediaContent

Represents a document file that can be loaded from a local path. URLs are not supported for security reasons.

Link copied to clipboard
data class Image(val source: String) : MediaContent

Represents image content that can be loaded from a local file or URL.

Link copied to clipboard
class Video(val data: ByteArray, val format: String) : MediaContent

Represents video content stored as byte array.

Properties

Link copied to clipboard
abstract val format: String?

The file format/extension of the media content.

Functions

Link copied to clipboard
abstract fun getMimeType(): String

Retrieves the MIME type of the media content.

Link copied to clipboard
abstract fun toBase64(): String

Converts the media content to base64 encoded string.