mx_send_media: Send a media file to a room

View source: R/media.R

mx_send_mediaR Documentation

Send a media file to a room

Description

Uploads path to the media repository and posts an m.room.message referencing it. The default info carries mimetype and size; pass richer metadata (width, height, duration) yourself – mx.api deliberately does not inspect media files.

Usage

mx_send_media(
  session,
  room_id,
  path,
  body = basename(path),
  msgtype = NULL,
  content_type = NULL,
  info = list()
)

mx_send_file(
  session,
  room_id,
  path,
  body = basename(path),
  content_type = NULL,
  info = list()
)

mx_send_image(
  session,
  room_id,
  path,
  body = basename(path),
  content_type = NULL,
  info = list()
)

mx_send_audio(
  session,
  room_id,
  path,
  body = basename(path),
  content_type = NULL,
  info = list()
)

mx_send_video(
  session,
  room_id,
  path,
  body = basename(path),
  content_type = NULL,
  info = list()
)

Arguments

session

An "mx_session" object.

room_id

Character. The room ID.

path

Character. Path to the file to upload.

body

Character. Message body / filename shown by clients.

msgtype

Character or NULL. One of "m.file", "m.image", "m.audio", "m.video". NULL (the default) derives it from the MIME type, so a .mp4 posts as m.video without being told.

content_type

Character or NULL. MIME type (guessed from the extension when NULL).

info

List. Extra fields merged into the info object.

Value

The event ID of the sent message.

Examples

## Not run: 
mx_send_media(s, "!abc:example", "clip.mp4", msgtype = "m.video")

## End(Not run)

mx.api documentation built on Sept. 12, 2026, 1:07 a.m.