Getting an video recommendations from the Oovvuu API can happen in two different ways, this will depend on your internal workflow.
Video Details Fragment
For all videos we use the same object, you are able to see the full object in our https://api-discovery.oovvuu.media
All the video recommendation examples will use this fragment
fragment VideoDetailFragment on Video {
id
title
description
tags
thumbnail(input: { width: 500, height: 281 }) {
url
}
preview(input: $previewInput) {
brightcoveVideoId
brightcovePlayerId
brightcoveAccountId
}
collection {
id
provider {
id
name
legalName
logo(input: { width: 100, height: 100 }) {
url
}
}
}
genres
duration
created
modified
activeSince
providerAssetId
}
Single Result Set
The Single Result Set is used when you only want a single array of videos returned, this is good for very targeted results when you can control the position of each video. For this you will need to follow the workflow of
- Gaining the 'wordings' that will be used for recommending the videos
- This is gained by using the 'textAnalysis' query
- Alternatively can be user entered, ie in a search box, text box
- Use the 'wordings' to get a list of videos that match
- Use the 'videoSet' query
NOTE: to get the wordings for an article, please refer to Text Analysis
Sample query:
query videoSet($input: VideoSetInput!, $previewInput: PlaybackInput!){
videoSet(input: $input) {
totalCount
pageResults { ...VideoDetailFragment }
cursor
}
}
with variables
{
"input": {
"filter": {
"keywordMatch": [ "brexit" ]
},
"sort": [
{ "sort": "id", "ascending": false }
]
},
"previewInput": {
"domain": "compass.oovvuu.media"
}
}
Article Recommendations
This is a query that will provide the video recommendations for the article, providing both the recommendations for the hero and fourth paragraph.
- Use the 'videosForArticle', providing the article title and body text.
This will return the hero and fourth paragraph video recommendations
Sample query:
query ($input: ArticleRecommendationInput, $previewInput: PlaybackInput!) {
videosForArticle(input: $input) {
hero { ...VideoDetailFragment }
heroSecondary { ...VideoDetailFragment }
heroEmptyReason
positionTwo { ...VideoDetailFragment }
positionTwoSecondary { ...VideoDetailFragment }
positionTwoEmptyReason
alternateSearches {
approximateTotalCount
filter { ...VideoFilterFragment }
previewImage(input: { height: 100, width: 100 }) {
url
}
}
}
}
Embedding Videos
Once you have the list of videos that you wish to embed in an article, you can use this to create the embed link script. To create the embed link you
- use the 'createEmbed' mutation to create the embed link.
You will need to provide the 'wordings' that you used to generate the embed code, this is to match the keywords to videos for better results in the future.
Please see Embedding Videos