Skip to main content

Channel Service

Purpose

The primary purpose of the Mosaic Channel Service is to provide content editors and broadcasters with the tools necessary to create dynamic linear streaming channels. Using the FAST (Free Ad-supported Streaming TV) model, our service enables the seamless integration of VOD-based movies and episodes into curated playlists, ensuring a continuous viewing experience for your audiences. By providing a platform that supports the easy insertion of advertisement placeholders and promotional content at designated cue points, the Channel Service enhances viewer engagement and maximizes ad revenue potential for broadcasters.

The Channel Service aims to simplify the management and scheduling of linear streams. Editors can efficiently organize programming by defining start times for each playlist, allowing for a well-structured schedule. This documentation serves as a comprehensive guide on the capabilities of the Channel Service.

The Channel Service is a microservice designed with a microfrontend architecture, allowing it to integrate with various Mosaic content and asset management systems seamlessly. This integration ensures an efficient workflow for managing video assets, images, and localized content. The Channel Service publishes the collective data to the Catalog and VOD-to-Live services. The catalog service can then list the available content, while the VOD-to-Live service can dynamically generate linear streaming channels based on VOD assets.

Channel Service Context Diagram

Channel Service Context Diagram

Features

Manage Channels

The Channel Service offers channel management capabilities, allowing editors to create, edit, and organize channels with ease. They can quickly set up new channels, providing the channel title and description. The title and description can be localized (if that feature is enabled) via the Localization Service into different locales.

Editors can be defined per channel if that channel should be DRM protected via the Axinom DRM Service or if the stream should be unprotected. The DRM credentials and the DRM orchestrations are handled by the VOD-to-Live Service.

Channel management steps

Channel management steps

Designers can assign a unique logo for every channel. The logo image can be uploaded and managed in the Mosaic Image Service.

To ensure a seamless viewing experience, even during times when no active playlist is available, users can upload a placeholder video. This video will be played automatically whenever the channel does not have scheduled content. This feature is particularly useful for maintaining a continuous stream and reducing viewer drop-off during unscheduled periods.

Additionally, the Channel Service includes features for validating and publishing channels. Management users can validate channels to ensure all fields are filled and localized and a logo and placeholder video is provided. Any error or warning will be shown so they can then resolve any found issue.

If the publish validation found no errors, the channel can be published, making it available to viewers via the VOD-to-Live Service and the Catalog Service. If needed, channels can also be unpublished to temporarily remove them from the linear stream, or deleted entirely if they are no longer required.

Manage Playlists

The Channel Service provides comprehensive tools for managing playlists, enabling editors to schedule and curate content from VOD entities. Playlists can be scheduled to start at specific dates and times, ensuring that programming aligns with the intended broadcast schedule.

Playlist management steps

Playlist management steps

Filling a playlist involves selecting movies or episodes as program items and organizing them into a programming schedule. The main video of the added movie or episode and the cover image are assigned to the newly created program item. Editors can easily decide the order in which these items will appear, ensuring that content flows seamlessly and meets programming goals.

Each program item can have its title adjusted, with the default title copied from the selected movie or episode. Additionally, titles can be localized into different locales, enhancing accessibility for your audiences.

The Channel Service supports the integration of advertisements within playlists. The program videos come with pre-defined ad cue points where editors can insert pre-roll, mid-roll, and post-roll ad spots. Editors can define the duration of these ad spots, allowing for precise control over the length and timing of advertisements. In addition to ad spots, promotional videos can also be inserted at these cue points, offering opportunities for cross-promotion and additional viewer engagement.

Before a playlist is published, it undergoes a validation process. This validation ensures that all videos included in the playlist meet the required standards for video format, bit rate, and other technical specifications. Additionally, it verifies that localizations are correctly provided if that feature is enabled. For the actual publishing, the system collects all necessary metadata information from the playlist and integrates details from the image service, video service, and localization service. This data is then combined and published via a publishing event. Similar to channels, a playlist can also be unpublished or completely deleted.

Development Features

The Channel Service is built following the Mosaic Development best practices, ensuring a robust, scalable, and efficient system. PostgreSQL is used as our relational database to store the Channel Service data. For messaging and asynchronous operations the service integrates RabbitMQ, facilitating reliable and efficient communication between the Mosaic managed services and the VOD-to-Live and Catalog Service. Additionally, GraphQL is used for our API, enabling flexible and efficient data retrieval and mutation.

Channel Service integration view

Channel Service integration view

On the front end, the Channel Service leverages the Mosaic UI library, which offers a comprehensive set of components and tools designed for building intuitive and responsive user interfaces. This is complemented by Mosaic’s workflow guides.

The Channel Service is part of the Mosaic Media Template Solution in the folder services/channel/service for the back-end related code and services/channel/workflows for the microfrontend code.

Domain Model

The following diagram shows the domain model of the Channel Service:

Domain Model

Domain Model

EntityDescription
channelsThe channel model contains the editable metadata of the channel, the used linear streaming URLs, and optional DRM information.
channel_imagesThe channel logo ID is stored in this table and might be extended to other types of channel images.
playlistsIncludes the playlist title and the start date and time. It automatically calculates the duration of the playlist based on the length of the associated programs and cue point schedules.
programsA program includes the title, image ID, video ID, and the entity ID/type from the corresponding movie/episode.
program_cue_pointsDefines a time point within a program, where it is possible to plan an interruption of the actual video. This includes the "ad_spot" cue point timings from the referenced video and always a pre and post-roll cue point.
cue_point_schedulesFor every program cue point editors can add one or multiple ad-spot placeholders or reference a video from the video service. Program cue points can also be left empty.

GraphQL and Metadata

Mosaic services follow a database-first approach, which is central to the Channel Service. All database adjustments are managed through database migrations located in the "migrations" folder. Leveraging the database structure and its relationships, PostGraphile automatically generates a robust GraphQL API, providing powerful query capabilities and comprehensive operations for creating, updating, and deleting entities. Additionally, we utilize Zapatos to generate TypeScript types for strongly typed direct database access, maintaining type safety without introducing unnecessary abstractions. This setup allows for easy adjustments and extensions of entities.

You can find the database migrations in the channel folder ./service/migrations. To adjust and fine-tune the generated GraphQL API you can change the initialization instructions and plugins in the folder ./service/src/graphql and the domain-specific adjustments in the ./service/src/domains subfolders.

Video Service Integration

Channel Placeholder Video

The Channel Service integrates with the Mosaic Video Service which allows encoding and managing video assets. Video assets are used as channel placeholder videos, ensuring there is always content available during periods when no active playlists are running. Additionally, video assets are utilized as VOD (Video on Demand) assets for movies and episodes within the Media Service. When an editor adds a movie or episode to a playlist, the associated VOD asset is automatically used to create the program item, streamlining the content management process.

Program Video Cue Points

An important feature of the Channel Service is the ability to register cue points of the type "ad spot." Editors can define these ad spot cue points for videos within the Video Service. The programs management station queries those cue points from the Video Service via the microfrontend integration. Editors use them to insert ad placeholders and promotional videos for programs. These promotional videos are also managed within the Video Service. This integration allows for precise control over where advertisements appear within the content, enhancing the monetization potential and viewer engagement.

Program Video Validation and Publishing

During publishing, the Channel Service queries the Video Service for detailed information about the video assets. These details are crucial for validating that all video specifications, such as format and bit rate, meet the required standards. The gathered information is then included in the publishing event message, ensuring that all relevant metadata for the VOD-to-Live and Catalog Service is included.

Image Service Integration

The Image Service manages images and provides them for consumer apps. Images are uploaded into the Image Service and categorized by specific image types defined by various services. For the Channel Service, the image type "channel_logo" is registered. This allows channel workflows to integrate the Image Service microfrontend to select an image of this type to be used as the channel logo, ensuring consistent branding and visual identity across the platform.

When a VOD entity (movie or episode) is added to a playlist as a program item, the Channel Service also includes the associated image of that VOD entity, enriching the program item with a visual element.

During the publishing process, the Channel Service queries the Image Service for detailed information about the images used. The image information is then used for validation and included in the publishing event message, ensuring that all required image metadata is provided to the consumers of the publishing event.

Localization Service Integration

The Localization Service receives the localizable source values from the Channel Service and allows translators to localize those values. This integration is used for both channel entities and the program items within a playlist. By registering the channel and program item types in the Localization Service, the Channel Service defines the fields that need to be localized and their validation logic. Translators can then provide localized values for these fields across different locales, ensuring that the content is accessible and engaging for different countries and regions.

When editors select a movie or episode as a program item, the title in the original language along with its localizations are automatically copied over to the corresponding program item and its localizations. The ability to edit and localize program items enhances the viewer experience by providing content in their preferred language/locale.

During publishing, the Channel Service queries the Localization Service to validate the localizations and retrieve the localized values. These localizations are then included in the publishing event message.

The localization feature can be enabled by setting the IS_LOCALIZATION_ENABLED variable to true and enabling the localization service for your environment. This flexibility allows you to easily enable or disable localization based on your specific needs, ensuring a tailored and efficient content delivery process.

Messaging

The Channel Service employs asynchronous messaging and adheres to the transactional inbox and outbox pattern to ensure reliable communication across services. This robust messaging system plays an important role in maintaining the integrity and consistency of operations. When a channel or playlist is published or unpublished, the service sends out corresponding event messages to notify other components and services.

Additionally, the Channel Service listens to messages from the VOD-to-Live Service, enabling it to receive notifications when the linear stream was created about DASH and HLS playback URLs and, optionally, DRM protection key IDs. This capability ensures that the Channel Service can dynamically adapt to changes and provide up-to-date streaming information. Furthermore, whenever a channel or program item is created, updated, or deleted, the service sends a command message to the Localization Service including new or changed localization source values. This interaction allows the Localization Service to set the localized source values, ensuring that all content remains consistent and accessible in different languages.

During the service startup, the Channel Service sends messages to declare cue point types to the Video Service, image types to the Image Service, and entity definitions required for localizations to the Localization Service. This initialization step ensures that all necessary configurations are in place, enabling smooth operation and integration with other services. For developers looking to understand or extend the messaging capabilities, a good starting point is the ./service/src/messaging/register-messaging.ts file, which provides an overview of the messaging setup and utilized message types.

You can find the messages and their payload definitions in the folder /libs/media-messages/schemas/payloads/channel.

Microfrontend APIs

We employ microfrontends in our service to ensure full independence across the entire platform, including the UI. This approach allows each microservice to function autonomously while providing well-defined integration points for smooth communication and interaction between microservices. This architecture not only enhances scalability and maintainability but also allows for rapid development and deployment of new features without disrupting the overall system.

Program Entity Providers

The Channel Service Pilet registers a FAST provider, which enables other customizable service workflows to provide VOD-based entities as a source for the playlist program items. The Movie Service uses this to allow the selection of movies and episodes as program items. This is achieved through the provider registration feature provided by @axinom/mosaic-portal. For more details on providers and their usage, please refer to the Providers section in the @axinom/mosaic-portal documentation.

In the Pilet registration function, use the app.addProvider method to register a FAST provider. Provide the necessary configuration, such as the provider type, label, selection component, and details resolver. The selection component allows you to create a custom component for selecting entities, while the details resolver specifies the route for navigating to the details station of the selected entity.

Management UI

The Channel Service provides a microfrontend for managing channels and playlist details. It plugs seamlessly into the Management System where it can be used together with the other Mosaic Services.

Channel Service Workflow Map

Channel Service Workflow Map

The channel explorer station provides an overview of all channels within the system. This station allows editors to view existing channels or create new ones.

Channel Details Station

The channel details station allows editors to view and edit the metadata of a channel. They can define if the channel linear stream should be DRM-protected or not.

Channel details station

Channel details station

Channel actions:

  • Playlists - manage playlists associated with the channel.
  • Manage Logo - assign a logo image for the channel.
  • Manage Placeholder Video - assign a placeholder video that will be used when there is no active playlist or if an ad-spot was not sold.
  • Publishing - validate and publish the channel.
  • Localization - localize channel details.
  • Delete - remove the channel from the system.
  • Unpublish - remove a published channel from the Catalog and VOD-to-Live Service.

Playlist Details Station

The playlist management is reached from the owning channel details station. It has an explorer station that provides an overview of all the playlists associated with that channel. By default, it applies a filter to show only upcoming playlists.

From there, editors can open an existing playlist or create a new one. The playlist details station allows setting the playlist start time and the title and shows the calculated duration and end time of the playlist.

Playlist details station

Playlist details station

Playlist actions

  • Programs - add and remove program items
  • Program Details - via the program item context menu you can get to a program details station.
  • Program Localizations - via the program item context menu or from the program details station.
  • Publishing - validate and publish the playlist.
  • Delete - removes the playlist from the channel. Only playlists in the state 'Not Published' can be deleted.

Programs Management

The programs station allows editors to manage the streaming schedule. Editors can assign media entities (movies or episodes) as program items and fill the program cue points with content (Ad Pods or Videos).

Program Management

Program Management

After adding an entity to the playlist, the workflow will offer various options to plan interruptions of the linear stream at defined points in time.

The Channel Service will automatically create a program cue point for each AD_SPOT cue point the program’s video has. In addition, it allows to plan an interruption also at the beginning and end of each program.

To manage the cue points, editors can use the corresponding workflow on the Video Service.

Each cue point schedule can consist of one or more of the following options:

  • A video from the Video Service: this can be used for bumper videos, promo videos, etc.
  • An ad pod: this can be used for ad insertion via SSAI (server-side ad insertion)

When the VOD-to-Live Service encounters an ad spot it sets a SCTE-35 marker in the stream to indicate the start and end of the ad break. This allows the server-side ad insertion service to insert ads into the stream. As a fallback, the service usually schedules the channel placeholder video to be played during the ad break. This will be used in cases where the SSAI fails, or when for specific users the ad break can only be partially filled with ads. The precise behavior however is defined by the VOD-to-Live Service.

Configuration Settings

The Channel Service follows the general pattern of using common ENV variables for providing configuration settings on the service start-up. Those are about the service ID, database connection, RabbitMQ connection, etc. The Channel Service specific variables are the following:

variable

type

description

SERVICE_ACCOUNT_CLIENT_ID & SERVICE_ACCOUNT_CLIENT_SECRET

string

The service account client ID and secret. The account needs the following permissions:

  • channel-service: ADMIN
  • ax-image-service: IMAGES_EDIT
  • *ax-video-service: VIDEOS_ENCODE
  • ax-localization-service: SETTINGS_VIEW, ENTITY_DEFINITIONS_VIEW, SOURCE_ENTITIES_VIEW, LOCALIZED_ENTITIES_EDIT, and LOCALIZED_ENTITIES_REVIEW.

IS_LOCALIZATION_ENABLED

boolean

If the localization feature should be enabled or not.

PLAYLIST_SHOULD_BE_24_HOURS

boolean

Should the playlist be extended via the channel placeholder video to have a duration of 24 hours?

Permissions

Mosaic services use an authorization mechanism based on permissions. The Channel Service defines the following permissions that can be assigned to user roles or service accounts:

PermissionGrant
CHANNELS_VIEWGrants read access to channels, playlists, and their sub-objects like channel images, playlist programs, program cue points, ...
CHANNELS_EDITGrants create, update, and delete on the above-mentioned items.
ADMINThis permission combines the CHANNELS_VIEW and CHANNELS_EDIT permissions.

Editors need additional permissions to be fully able to work with the services integrated by the Channel Service:

  • Image and Video Service:
    • Image view permissions to select images/videos and to get the data for publishing.
    • Image edit permissions to upload images/encode videos.
  • Localization Service:
    • Localized entities view permissions to get the data for publishing.
    • Localized entities edit/review permissions to modify or review localizations.
  • Media Service:
    • Movie/TV show view permissions to select movies and episodes as program items.