Media notifications

media_identify_extension

Try to find a filename extension for a mime type (example: ”.jpg”)

Type:
first

Return:

#media_identify_extension{} properties:
  • mime: binary
  • preferred: undefined|binary

media_identify_file

Try to identify a file, returning a list of file properties.

Type:
first

Return:

#media_identify_file{} properties:
  • filename: unknown
  • original_filename: unknown
  • extension: unknown

media_import

Notification to translate or map a file after upload, before insertion into the database Used in mod_video to queue movies for conversion to mp4. You can set the post_insert_fun to something like fun(Id, Medium, Context) to receive the medium record as it is inserted.

Type:
first
Return:
modified #media_upload_preprocess{}
#media_import{} properties:
  • url: binary
  • host_rev: list
  • unknown: unknown
  • metadata: tuple

media_import_props

Notification to translate or map a file after upload, before insertion into the database Used in mod_video to queue movies for conversion to mp4. You can set the post_insert_fun to something like fun(Id, Medium, Context) to receive the medium record as it is inserted.

Type:
first
Return:
modified #media_upload_preprocess{}
#media_import_props{} properties:
  • prio: pos_integer
  • category: atom
  • module: atom
  • description: binary|tuple
  • rsc_props: list
  • medium_props: list
  • medium_url: binary
  • preview_url: binary

media_replace_file

Notification that a medium file has been changed (notify) The id is the resource id, medium contains the medium’s property list.

Type:
notify
Return:
return value is ignored
#media_replace_file{} properties:
  • id: unknown
  • medium: unknown

media_stillimage

See if there is a ‘still’ image preview of a media item. (eg posterframe of a movie) Return:: {ok, ResourceId} or undefined

Type:
first

Return:

#media_stillimage{} properties:
  • id: unknown
  • unknown: unknown

media_update_done

Media update done notification. action is ‘insert’, ‘update’ or ‘delete’

Type:
first

Return:

#media_update_done{} properties:
  • action: unknown
  • id: unknown
  • pre_is_a: unknown
  • post_is_a: unknown
  • pre_props: unknown
  • post_props: unknown

media_upload_preprocess

Notification to translate or map a file after upload, before insertion into the database Used in mod_video to queue movies for conversion to mp4. You can set the post_insert_fun to something like fun(Id, Medium, Context) to receive the medium record as it is inserted.

Type:
first
Return:
modified #media_upload_preprocess{}
#media_upload_preprocess{} properties:
  • id: integer|insert_rsc
  • mime: binary
  • file: file:filename()
  • original_filename: file:filename()
  • medium: list
  • post_insert_fun: function

media_upload_props

Notification that a medium file has been uploaded. This is the moment to change properties, modify the file etc.

Type:
foldl
Return:
modified #media_upload_props{}
#media_upload_props{} properties:
  • id: integer|insert_rsc
  • mime: binary
  • archive_file: unknown
  • options: unknown

media_upload_rsc_props

Notification that a medium file has been uploaded. This is the moment to change resource properties, modify the file etc.

Type:
foldl
Return:
modified #media_upload_rsc_props{}
#media_upload_rsc_props{} properties:
  • id: integer|insert_rsc
  • mime: binary
  • archive_file: unknown
  • options: list
  • medium: list

media_viewer

Request to generate a HTML media viewer for a resource

Type:
first
Return:
{ok, Html} or undefined
#media_viewer{} properties:
  • id: unknown
  • props: list
  • filename: unknown
  • options: list