Video Recommendations icon

Whitepaper · 10.09.2024

Read time — 7 minutes

Video Recommen­dations Made Easy

with Axinom Mosaic and Recombee

The paper explains how to extend a video streaming backend built on Axinom Mosaic with AI-driven recommendations using Recombee.

Also check out our webinar, Video Recommendations Made Easy, produced in collaboration with Recombee.

Introduction

Delivering personalized experiences is essential for modern video platforms to engage users and enhance their content journey. Axinom Mosaic, a robust and modular service for media platforms, combined with Recombee, an AI-powered recommendation engine, provides a powerful solution for building personalized video portals.

This paper explores how to seamlessly integrate these two technologies, offering tailored video recommendations that enhance user engagement and drive viewer retention.

Mosaic Overview

Axinom Mosaic is a versatile service providing modular digital solutions for media and entertainment platforms. It facilitates the creation, management, and delivery of personalized content across various devices. With a scalable architecture, Axinom Mosaic integrates seamlessly with essential components like content management, digital rights management, and user management. This ensures tailored content experiences that enhance user engagement. Its flexibility and customization options make it an ideal choice for diverse media applications, including video streaming and interactive content.

Axinom media

Axinom Mosaic in an OTT-solution landscape

To build a video portal with Axinom Mosaic you would use the simplified architecture as depicted below.

In the Management System, editors will prepare and manage the data:

  • Media Service — to manage the core content entities and their metadata (Movies, TV Shows, Episodes)
  • Video Service — to orchestrate video encoding and associate the entities with their respective video streams.
  • Image Service — to manage images (such as movie covers) and render different resolutions on the fly.
  • Localization Service — to translate the metadata to different languages.

Frontend-facing services will serve the requests from the end-user frontends:

  • Catalog Service — aggregated and denormalized metadata coming from the Media, Image, Video, and Localization service.
  • User Service — end-user registration and authentication.
  • Personalization Service — storage of any runtime data in an end-user context, such as settings, favorites, watch progress, etc.

Axinom doesn’t provide a ready-made end-user frontend, letting implementers a possibility to integrate any frontend or develop it. Frontend Samples provided by Axinom show how to use the provided APIs in the client code.

Read more on a Mosaic Video Portal.

They key technologies used by Axinom Mosaic are:

Mosaic Technology Stack

Mosaic Technology Stack

Recombee Overview

Recombee is a recommendation service that leverages artificial intelligence and machine learning to deliver personalized recommendations across various digital platforms.

It supports real-time data processing, allowing for dynamic and highly relevant suggestions tailored to individual users. Recombee's system can be integrated into websites, mobile apps, and other digital services to enhance user experience by providing recommendations for products, content, and other items based on user behavior and preferences.

Its robust API and customization options make it versatile for different use cases and industries.

For a Video Portal, Recombee can cover a lot of valuable use cases (called Scenarios in Recombee), e.g.,

  • Just For You
  • Top Genres For You
  • Editor’s Picks For you
  • Search Movies/Series
  • Watch Next
  • Fully Personalized Homepage
Personalized homepage built with Recombee

Personalized homepage built with Recombee

Recombee use-cases

Recombee use-cases

There are three steps to use Recombee:

  • Provide Recombee with data about your users, content items, and their interactions
  • Configure scenarios that you want to use (apply business rules)
  • In the frontend, integrate the API to activate the scenarios and display the recommended results.

Data

The data which Recombee needs to generate recommendations includes:

  • Items data
  • Users data
  • Interactions

Interactions refer to users' behavior and can describe such actions as:

  • The User visits a detail page of a movie
  • The User plays a movie
  • The User watches a segment of a movie
  • The User adds a movie to the favorites
  • ...

Scenarios

Desired Scenarios can be configured using Recombee Administration UI.

For each scenario, Filters can be used to limit the amount of items which can be recommended (e.g. to avoid recommending items that are inaccessible to a user). Boosters can be used to prefer some items in a scenario in order to fulfill your business goals.

The rules can be configured using UI controls, but also using ReQL (Recombee Query Language) if you want to have deeper control of the business logic.

See Recombee documentation on Scenarios in general, and the Scenario recipes for common video use cases.

Frontend Integration

Recombee provides SDKs in different languages which simplify the implementation task on the frontend side. For example, to activate the Search scenario mentioned above, one would only need to call:

            
        const request = new rqs.SearchItems(userId, searchQuery, 10, {
          scenario: ‘search’
          });
          client.send(request);
            
          

The returned recommended search results can be displayed by the frontend in any desired way. If a user further interacts with a recommended item, this information should be also sent to Recombee and provide a valuable source of feedback for recommendations improvements.

Integration Guidelines

General

If a Video Portal is built based on Axinom Mosaic, most of the data needed by Recombee is already available within Mosaic services:

  • Items data — Catalog service holds data about each movie or episode, including title, description, genre, casts, etc., and this in multiple languages.
  • Users data — User service keeps track of a user identity (email) and Personalization service holds the user profile, including user’s name, country, age (age restriction), language preferences, etc.
  • Interactions — Some of the interactions are stored within the Personalization Service, including Favorites (called Bookmarks in Recombee), Ratings, and Watch Progress (called View Portions in Recombee).

Note: The quality of recommendations can be further improved if additional client-side interactions are also delivered to Recombee, such as Detail Views or Cart Additions. This can be implemented using the Recombee SDK added directly to the Frontend. However, with the base integration described here, a solid level for recommendations can be already achieved.

Axinom Mosaic Workflow with Recombee

For the rest of the white paper we will use the following reference architecture.

Reference architecture

Reference architecture

Connector for Recombee is a new piece which needs to be developed for a specific solution according to the provided guidelines.

Items Data

First, configure the needed item properties.
Go to Recombee Dashboard > Catalog > Items > Manage Properties.
Create the properties reflecting your data schema (see more under “Data Model” below).

Recombee provides two approaches to data synchronisation: push (using an API) and pull (using a Catalog Feed).

Pull (Catalog Feed)

Recombee can periodically pull a Catalog Feed from an external URL. The feed can be in any format - JSON, XML, CSV, Atom/RSS, etc.

Read Catalog Feeds Documentation.

Mosaic Catalog Service already exposes items in JSON format:

            
        query GetAllMovies {
          movies {
            nodes {
                id
                title
                description
        	  cast
                studio
                released
                synopsis
                …
              }
            }
        }
            
          

Results:

            
        {
          "data": {
            "movies": {
              "nodes": [
                {
                  "id": "movie-1",
                  "title": "Monster Hunter one",
                  "description": "A portal transports Lt.Artemis and an elite unit of soldiers to a strange world where powerful monsters rule with deadly ferocity. Faced with relentless danger, the team encounters a mysterious hunter who may be their only hope to find a way home."
                },
                {
                  "id": "movie-10",
                  "title": "Godzilla vs. Kong",
                  "description": "In a time when monsters walk the Earth, humanity’s fight for its future sets Godzilla and Kong on a collision course that will see the two most powerful forces of nature on the planet collide in a spectacular battle for the ages."
                },
        …
        
            
          

You would need a small adapter that accepts a GET request from Recombee, issues a GraphQL request to Mosaic Catalog Service, and forwards the response to Recombee.

Exposing Mosaic Catalog to Recombee

Exposing Mosaic Catalog to Recombee

On the Recombee side, you can define a field mapping:

Field mapping

See Custom JSON for more details.

As a result, you have your items data in Recombee:

Items data
Push (API & SDK)

Alternatively, you can push the items data to Recombee using Recombee SDK.

The items data is managed by the editors in the Media Service. When an item is “ready”, editors publish the item. Technically, Media Services emits an “MoviePublished” event using RabbitMQ message broker. Anybody can subscribe to this event. One of the subscribed clients is the Catalog Service. It stores the data in its own database ready to serve to the frontends. I.e., the data state in the Catalog Service is the “truth” that should be visible for the end users.

You can also subscribe to the MoviePublished event, and once you have the data - send it further to Recombee.

Subscribing to events in Mosaic

Subscribing to events in Mosaic

The code looks roughly like this:

            
        import { BrokerAsPromised as Broker } from "rascal";
        
        const broker = await Broker.create({
            vhosts: { ... vhost configuration ... },
            ...
        });
        const subscription = await broker.subscribe("MoviePublished");
        subscription.on("message", (_messageBrokerMetadata, content, ackOrNack) => {
            const movieMessage = content.payload as MoviePublishedEvent;
            // MoviePublishedEvent type comes from media-messages library, and includes for example
            // - movieMessage.id
            // - movieMessage.title
            // ...
            ackOrNack();
        })
            
          

Use Recombee SDK and the SetItemValues API call to send the data about specific catalog items to Recombee.

Example:

            
        const recombee = require('recombee-api-client');
        const requests = recombee.requests;
        
        const client = new ApiClient(RECOMBEE_DB_ID, RECOMBEE_APIKEY, {region: RECOMBEE_REGION});
        await client.send(new requests.SetItemValues(itemId,
                {
                    "title": “Barbie”,
                    "description": “Barbie and Ken are having the time of their lives in the colorful and seemingly perfect world of Barbie Land. However, when they get a chance to go to the real world, they soon discover the joys and perils of living among humans.”,
                },
        	  cascadeCreate: true
                ));
            
          

User Data (Optional)

User data—e.g., country, subscription level, age — can be used to filter the content suitable for each user and provide the initial recommendations for cold-start (new) users.

First, configure the needed user properties.
Go to Recombee Dashboard > Catalog > Users > Manage Properties.
Create the properties reflecting your data schema (see more under “Data Model” below).

You can create users and set their properties in Recombee similar as we did it above for Items - with SetUserValues() method (just there is no “feed” concept available for users).

            
        const request = new requests.SetUserValues(userId,
          {
              "max_parental_rating": "NC16",
              "subscription": "premium"
          },
          cascadeCreate: true
        );
        await client.send(request);
            
          

In Mosaic, there are two services dealing with user data:

  • User Service — responsible for identification, authentication, and profiles.
  • Personalization Service — responsible for storing any user-related properties.

Personalization Service is essentially a key-value store, where the key-value pairs are stored in the context of a User, User Profile, and an Application. Typical data handled by the Personalization service includes:

  • User preferences
  • User profile data
  • Favorites/Bookmarks
  • Usage history
  • Playback progress/View portions

As with any other Mosaic Service, Personalization Service offers a GraphQL API, through which you can conveniently extract the needed user’s properties.

Passing user data from Mosaic to Recombee

Passing user data from Mosaic to Recombee

Mosaic is not opinionated on what User properties to use. But in conjunction with Recombee, the following information may prove useful:

  • Age
  • Gender
  • Location
  • Language
  • Membership/Subscription Level
  • Interest and preferences
  • etc.

You could periodically pull the fresh data from the Personalization Service, e.g., for the newly registered users or for any changes made after a certain timestamp.

Interactions

Interactions are the core of Recombee. Here we will look into the following interaction types:

All this information can be stored in the Personalization service.

For Ratings and Bookmarks, the regular Data API (and Array API) can be used.

For View Portions (Playback progress in Mosaic), there is an optimized API (called Progress API) that allows it to handle high traffic (e.g., when a video player sends an update every couple of seconds).

Passing interactions from Mosaic to Recombee

Passing interactions from Mosaic to Recombee

You could periodically pull the fresh data from the Personalization Service, e.g., for the new interactions and the updates for the View Portions.

Recombee provides API endpoints for sending the individual types of interactions:

            
        client.send(new requests.AddBookmark(userId, itemId))
        
        
        // rating is a value from -1 (negative) to 1 (positive)
        client.send(new requests.AddRating(userId, itemId, rating))
        
        
        // portion is the percentage watched (0.0 to 1.0)
        client.send(new requests.SetViewPortion(userId, itemId, portion))
            
          

There are some useful optional parameters that can be passed along:

  • timestamp — useful when sending initial historical upload (default is the current timestamp).
  • recommId — ID of recommendation thanks to which user interacted. Useful for providing feedback for the models and for precise analytics.

You could periodically pull the fresh data from the Personalization Service, e.g., for the new interactions and the updates for the View Portions.

Recommendations

To get the Recommendations, you first define the desired Scenarios in the Recombee Dashboard. To each Scenario, you can add Filters, Boosters, and Constraints.

See the Scenario Recipes section in the Recombee documentation to see how common use cases in the video domain are set up.

Recombee API offers various endpoints for getting recommendations and search results:

  • Recommend Items to User
    1. Various homepage rows (Just For You, Trending in Your Country, New Releases For You, …)
    2. Emailing Campaigns
  • Recommend Items to Item
    1. Related Videos, Watch Next, Because You Watched, …
  • Search Items
    1. Personalized full-text search
  • Recommend Items Segments to User
    1. Recommending user's favorite genres
    2. Personalized re-ordering of the homepage rows
    3. Recommending actors or directors
  • … and more.

To activate a Scenario to actually get recommendations, you use the code similar to this (in this case, for Item-to-Item recommendations):

The results looks like below:

            
        {​
            "recommId": "d3f2a7b4-8c3e-42b9-97c4-a7f0c5f6e1d9",​
            "recomms": [​
                {​
                    "id": "movie-42",​
                    "values": {​
                        "title": "Inception",​
                        "year": 2010,​
                        "requires_subscription": true,​
                        "actors": ["Leonardo DiCaprio", "Joseph Gordon-Levitt", "Elliot Page"]​
                    }​
                },​
                {​
                    "id": "movie-102",​
                    "values": {​
                        "title": "The Shawshank Redemption",​
                        "year": 1994,​
                        "requires_subscription": false,​
                        "actors": ["Tim Robbins", "Morgan Freeman", "Bob Gunton"]​
                    }​
                },​
               ...​
            ],​
            "numberNextRecommsCalls": 0​
        }
            
          

You can preview the Scenario results in the Recombee dashboard to make sure you get the desired results.

Recommendations can be requested either by the Frontend (client-side) or by the Backend (server-side). In the former case the Frontend talks directly with Recombee and is responsible for merging the data from the Catalog Service and from Recombee. In the latter case, the Catalog Service is extended to talk with Recombee and to return already aggregated results to the Frontend. For the Frontend there is only a single point of contact - the Catalog Service and its GraphQL API.

Server-side recommendations

Server-side recommendations

Data Model

In Mosaic, developers can freely define their data model. The Media Template available in Open Source offers out of the box the following entities:

Media Service Data Model

Media Service Data Model

Recombee is generally agnostic to a data schema - any properties of the items can be defined.

Here is a list of properties often used in the video domain. However, you can definitely add much more information you store about your assets.

At the same time, Recombee offers useful features that can be used to improve the results specifically in a Video Portal scenario.

Segmentation

Segments are groups of Items defined based on the values of specific properties. An obvious segmentation taken from the schema above would be based on Genres.

There are interesting use cases associated with the Segmentations:

Series

Items in the catalog may be organized into series, expressing an explicit, known ordering of items, if there is any. With the schema above, the episodes in the same TV Show season are a good example of a series.

Series can be created using the Recombee API, and items can be added to series using InsertToSeries API call.

If Mosaic Collections are used, they also can be modeled in Recombee using Series.

Where to go from here

The basic integration described above provides a good solution already.

It can be further improved by:

  • Adding additional interactions on the frontend-side, such as “Detail Views”, “Cart additions” or “Purchases” (if applicable). This can be achieved by adding code snippets using Recombee SDK to the frontend code.
  • Considering hierarchies, like TV Show - Season - Episode and Collections.
  • Adding more Scenarios.
  • Applying business rules for recommendations leveraging specifics of the data schema and business use case.
  • Increasing the frequency of feeding data into Recombee (e.g., if it was once daily at the start, it can be increased to hourly or even more) to get recommendations more in real-time. Especially the interactions should be sent with as little delay as possible.

Conclusion

The integration of Axinom Mosaic with Recombee offers a comprehensive solution for video portals, bringing together modular backend architecture with advanced recommendation capabilities. This powerful combination enables media companies to meet the increasing demand for tailored content, fostering deeper user engagement and loyalty.

By further optimizing interactions and continuously refining recommendations, video platforms can create more dynamic, personalized viewing experiences that cater to individual preferences in real-time.

Book meeting

Want to know more about Mosaic or Recombee?

Don’t have time now?
Book a call