Player Integration - Content Moderation
Player Integration
The playkit-js-moderation plugin adds a "Report" button to the Kaltura Player, letting viewers flag content directly from the player UI.
Configuration
const config = {
plugins: {
moderation: {
moderateProcessColor: '#00B4D8',
reportLength: 500,
notificationType: 'toast',
subtitle: 'Report inappropriate content',
onlyWhenPlaying: false
}
}
};
Plugin options:
| Option | Type | Default | Description |
|---|---|---|---|
moderateProcessColor | string | '#00B4D8' | Color for the loading/progress indicator |
reportLength | number | 500 | Max characters for the report comment |
notificationType | string | 'toast' | How to show success/error — 'toast' or 'overlay' |
subtitle | string | '' | Subtitle text below the "Report" heading |
onlyWhenPlaying | boolean | false | If true, the report button only appears during playback |
Events
The plugin fires events on the player's event bus:
| Event | When |
|---|---|
moderation:open | Report dialog opens |
moderation:close | Report dialog closes (cancel or submit) |
moderation:submit | Report submitted — payload includes { flagType, comments } |
moderation:success | Server confirmed the flag was created |
moderation:error | Flag creation failed — payload includes { error } |
player.addEventListener('moderation:success', (event) => {
console.log('Content reported successfully', event.payload);
});
How It Works
When a viewer submits a report, the plugin calls baseEntry.flag using the player's widget KS. The flag appears in the moderation queue alongside flags created via the API. No additional server configuration is needed — the plugin uses the same flagging endpoint documented in User Flagging.