Skip to content

Commit 9a8d518

Browse files
Merge pull request #51 from apivideo/add-sequence-param
Add sequence param
2 parents 3a21723 + 02386c8 commit 9a8d518

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [1.2.24] - 2023-03-03
5+
- Add `sequence` option
6+
47
## [1.2.23] - 2023-02-15
58
- Add `privateSession` option
69

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ The PlayerSdk constructor takes 2 parameters:
151151
| showSubtitles | no (default: false) | boolean | the video subtitles are shown by default |
152152
| loop | no (default: false) | boolean | once the video is finished it automatically starts again |
153153
| playbackRate | no (default: 1) | number | the playback rate of the video: 1 for normal, 2 for x2, etc. |
154+
| sequence | no | {start: number, end: number} | define a sequence of the video to play. The video will start at the `start` timecode and end at the `end` timecode. The timecodes are in seconds. |
154155

155156

156157
The sdk instance can be used to control the video playback, and to listen to player events.

index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ type SdkOptions = {
3939
privateSession?: string;
4040
showSubtitles?: boolean;
4141
playbackRate?: number;
42+
sequence?: {
43+
start: number;
44+
end: number;
45+
}
4246
}
4347

4448
type PlayerSdkEvent = {
@@ -349,6 +353,10 @@ export class PlayerSdk {
349353
url = addParameterInIframeHash("show-subtitles");
350354
}
351355

356+
if(!isNaN(parseInt(""+options.sequence?.end, 10)) && !isNaN(parseInt(""+options.sequence?.start, 10))) {
357+
url = addParameterInIframeHash(`t=${options.sequence?.start},${options.sequence?.end}`);
358+
}
359+
352360
return url;
353361
}
354362

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@api.video/player-sdk",
3-
"version": "1.2.23",
3+
"version": "1.2.24",
44
"description": "api.video player SDK",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)