
Setup
Step 1: Set up Velt Components in your app
You will be using the following components:Velt Comments: Renders comments on the DOM.Velt Comment Tool: Enables or disables adding comments.Velt Reaction Tool: Enables or disables adding reactions.Velt Comment Player Timeline: Adds comments bubble over your player seek bar.Velt Comments Sidebar: Adds a sidebar that shows all comments. Users can also search, filter & navigate to the comments from here.Velt Sidebar Button: Toggles the sidebar on/off.
A) Add the Velt Comments component in the root of your app
Add the Velt Comments component to the root of your app.
- React / Next.js
- Other Frameworks
B) Add the Velt Comment Tool component wherever you want your render the comment tool.
Note you can also provide your own button to this component.
- React / Next.js
- Other Frameworks
Disable Comment Tool
You can disable the comment tool to temporarily or conditionally restrict comment creation while still allowing users to view existing comments.
See Example
See Example
- React / Next.js
- Other Frameworks
C) Add the Velt Reaction Tool component wherever you want your render the reaction tool.
- Provide the video player ID on which you want the reactions to be added.
- Add an event handler to handle
onReactionToolClickevents.
- React / Next.js
- Other Frameworks
D) Place the Velt Comment Player Timeline component as a sibling to your video player.
- To show comment bubbles on your player seek bar, add the
Velt Comment Player Timelinecomponent as a sibling to your video player component. - It will auto adjust to the same width as your video player.
Right now we assume you have a maximum of one
velt comment player timeline component and one sibling video player component per documentIDEnsure that the parent container of
velt comment player timeline doesnt have CSS position value as ‘static’.videoPlayerId is optional and helps support multiple players/timelines on the same page.- If omitted, the timeline shows all comments for the current document (for the active version).
- If provided, the timeline shows only comments whose
location.videoPlayerIdmatches the givenvideoPlayerId.
location.videoPlayerId so the timeline can correctly associate comments with the player.- React / Next.js
- Other Frameworks
E) Add id to the video player or its parent element.
- If you don’t have access to the raw
<video>player, you can add anidto the parent element of the video player.
- React / Next.js
- Other Frameworks
F) Add the Velt Comments Sidebar component.
The Comments Sidebar displays all comments with search, filter, and navigation capabilities.
- React / Next.js
- Other Frameworks
Optional Properties:
embedMode: Embed the sidebar in your existing component instead of floating mode
See Example
See Example
- React / Next.js
- Other Frameworks
G) Add the Velt Sidebar Button component.
This will open or close the Comment Sidebar.
- React / Next.js
- Other Frameworks
Step 2: Set the total media length on the Velt Comment Player Timeline
You can pass an integer tototal media length using props to represent the total number of frames or seconds in the video:
- React / Next.js
- Other Frameworks
- React / Next.js
- Other Frameworks
Step 3: Detect Comment Tool Activation and Set Media Location
- Detect when the user activates the comment tool by adding an event handler to the
onCommentModeChangeevent. - Pause your player and set a new
Locationin the Velt SDK. - This ensures that the comments are tied to that particular media frame or timestamp.
- You can pass in a key value pair object that represents the current state of your player.
- If you are using the
Velt Comment Player Timelinecomponent, ensure to set the current mediaframeorsecondin the special keycurrentMediaPosition. - Use the same id in
location.videoPlayerIdthat you used inVeltCommentPlayerTimeline.currentMediaPositionis a protected keyword that is used to arrange the comment bubbles on top of the video player timeline in the correct spot
- React / Next.js
- Other Frameworks
Step 4: Detect Reaction Tool Activation and Set Media Location
- Detect when the user activates the reaction tool by adding an event handler to the
onReactionToolClickevent. - Pause your player and set a new
Locationin the Velt SDK. - This ensures that the reactions are tied to that particular media frame or timestamp.
- You can pass in a key value pair object that represents the current state of your player.
If you are using the
Velt Comment Player Timelinecomponent, ensure to set the current rounded frame or second in the special keycurrentMediaPosition.currentMediaPositionis a protected keyword that is used to arrange the comment bubbles on top of the video player timeline in the correct spot
- React / Next.js
- Other Frameworks
Step 5: Remove Velt Location when the player is played
CallunsetLocationsIds() so the video player can play without comments appearing in frames.
- React / Next.js
- Other Frameworks
Step 6: Navigate to the comment’s location in the player from the Sidebar or Timeline
Add theonCommentClick event handler on the Velt Comments Sidebar & Velt Comment Player Timeline components you added earlier.
The event will give you back the location object that you had set on the comment.
Use this object to:
- update your player state
- update the SDK’s
locationso the comments associated with thatlocationare rendered.
A) Handle click on the Velt Comments Sidebar
- React / Next.js
- Other Frameworks
B) Handle click on the Velt Comment Player Timeline
- React / Next.js
- Other Frameworks
| property | type | description |
|---|---|---|
documentId | string | The document ID where the comment was added |
location | object | The location where the comment was added |
targetElementId | string | The DOM ID of the target element on which the comment was added |
context | Object | Any context data passed when the comment was added |

