Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FEC-13134): add views and plays counts to media entry metadata if available #220

Merged
merged 4 commits into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/k-provider/ott/response-types/kaltura-asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ export default class KalturaAsset extends ServiceResult {
*/
pictures: Array<any> = [];

/**
* @member - Number of plays
* @type {number}
*/
plays: number;

/**
* @member - Number of views
* @type {number}
*/
views: number;

/**
* @constructor
* @param {Object} response The response
Expand All @@ -67,6 +79,8 @@ export default class KalturaAsset extends ServiceResult {
this.description = response.description;
this.createDate = response.createDate;
this.endDate = response.endDate;
this.plays = response.plays;
this.views = response.views;
this.metas = this._formatTagsMetas(response.metas);
this.tags = this._formatTagsMetas(response.tags);
this.pictures = response.images;
Expand Down
2 changes: 2 additions & 0 deletions src/k-provider/ovp/provider-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ class OVPProviderParser {
mediaEntry.metadata.name = entry.name || '';
if (entry.createdAt) mediaEntry.metadata.createdAt = entry.createdAt;
if (entry.endDate) mediaEntry.metadata.endDate = entry.endDate;
if (entry.views) mediaEntry.metadata.views = entry.views;
if (entry.plays) mediaEntry.metadata.plays = entry.plays;
mediaEntry.metadata.tags = entry.tags || '';
mediaEntry.status = entry.status;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@flow
const FIELDS =
'id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,endDate';
'id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,endDate,plays,views';
const RESPONSE_PROFILE_TYPE = {
INCLUDE_FIELDS: 1,
EXCLUDE_FIELDS: 2
Expand Down
14 changes: 14 additions & 0 deletions src/k-provider/ovp/response-types/kaltura-media-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ export class KalturaMediaEntry {
*/
endDate: number;

/**
* @member - Number of plays
* @type {number}
*/
plays: number;

/**
* @member - Number of views
* @type {number}
*/
views: number;

/**
* @constructor
* @param {Object} entry The json response
Expand All @@ -151,5 +163,7 @@ export class KalturaMediaEntry {
this.tags = entry.tags;
this.createdAt = entry.createdAt;
this.endDate = entry.endDate;
this.plays = entry.plays;
this.views = entry.views;
}
}