Audio and Video Support

Want to support audio or video files in articles?

To ensure correct session management for articles that include audio or video files please use the mediaType as defined below.

Introduction

For audio streams such as podcasts or for video playback, we use a different media type within the TIUN_UPDATE_CONTENT event.

Why it's important

Session management for audio/video differs from text. Devices can be in additional states, for example, a mobile screen can be locked while the audio still plays. Also, sessions should be paused/resumed based on a users pressing pause. To handle these events, it's crucial to include additional media types in the TIUN_UPDATE_CONTENT event.

Use the mediaType property

Use the mediaType property and define the type of media that is currently being consumed. For text media and reading, use - text. For audio media and listening, use - audio. For video playback, use - video.

This property is optional and is set to text by default.

function updateContentInfo() {

  window.postMessage(
    {
      type: 'TIUN_EVENT',
      content: 'TIUN_UPDATE_CONTENT',
      contentId: 'content ID',
      contentType: 'active',
      mediaType: 'video'
    },
    window.location.origin
  );
}

Last updated

Was this helpful?