@playkit-js/rapt 0.4.10-canary.0-878cdb7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ ## Canary CI/CD
2
+ name: Canary Full Flow
3
+ run-name: Canary Full Flow
4
+
5
+ on:
6
+ push:
7
+ branches:
8
+ - devops-deployment
9
+
10
+ jobs:
11
+ canary-full-flow:
12
+ if: ${{ github.actor != 'PlaykitJs-Bot' }}
13
+ uses: kaltura/ovp-pipelines-pub/.github/workflows/player_cicd.yaml@path
14
+ secrets:
15
+ PLAYER_CENTRAL_ACCOUNT_ID: ${{ secrets.PLAYER_CENTRAL_ACCOUNT_ID }}
16
+ PLAYER_SERVICES_ACCOUNT_ID: ${{ secrets.PLAYER_SERVICES_ACCOUNT_ID }}
17
+ PLAYER_S3_BUCKET_DEPLOYMENT: ${{ secrets.PLAYER_S3_BUCKET_DEPLOYMENT }}
18
+ PLAYER_S3_BUCKET_APPS: ${{ secrets.PLAYER_S3_BUCKET_APPS }}
19
+ PLAYER_NPM_TOKEN: ${{ secrets.PLAYER_NPM_TOKEN }}
20
+ PLAYER_LAMBDA_NAME: ${{ secrets.PLAYER_LAMBDA_NAME }}
21
+ PLAYER_MSTEAMS_WEBHOOK: ${{ secrets.PLAYER_MSTEAMS_WEBHOOK }}
22
+ PLAYER_GITHUB_BOT_TOKEN: ${{ secrets.PLAYER_GITHUB_BOT_TOKEN }}
23
+ with:
24
+ type: "plugin"
25
+ stage: "canary"
26
+ schema-type: "playerV3OvpVersions"
27
+ tests-yarn-run-to-execute: 'tgz build'
28
+
@@ -0,0 +1,24 @@
1
+ ## Prod CI
2
+ name: Prod
3
+ run-name: Prod
4
+
5
+ on:
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ prod:
10
+ uses: kaltura/ovp-pipelines-pub/.github/workflows/player_cicd.yaml@path
11
+ secrets:
12
+ PLAYER_CENTRAL_ACCOUNT_ID: ${{ secrets.PLAYER_CENTRAL_ACCOUNT_ID }}
13
+ PLAYER_SERVICES_ACCOUNT_ID: ${{ secrets.PLAYER_SERVICES_ACCOUNT_ID }}
14
+ PLAYER_S3_BUCKET_DEPLOYMENT: ${{ secrets.PLAYER_S3_BUCKET_DEPLOYMENT }}
15
+ PLAYER_S3_BUCKET_APPS: ${{ secrets.PLAYER_S3_BUCKET_APPS }}
16
+ PLAYER_NPM_TOKEN: ${{ secrets.PLAYER_NPM_TOKEN }}
17
+ PLAYER_LAMBDA_NAME: ${{ secrets.PLAYER_LAMBDA_NAME }}
18
+ PLAYER_MSTEAMS_WEBHOOK: ${{ secrets.PLAYER_MSTEAMS_WEBHOOK }}
19
+ PLAYER_GITHUB_BOT_TOKEN: ${{ secrets.PLAYER_GITHUB_BOT_TOKEN }}
20
+ with:
21
+ type: "plugin"
22
+ env: "prod"
23
+ schema-type: "playerV3OvpVersions"
24
+ tests-yarn-run-to-execute: 'tgz build'
@@ -0,0 +1,24 @@
1
+ ## CI - Player And Plugin Tests
2
+ name: Player And Plugin Tests
3
+ run-name: Player And Plugin Tests
4
+
5
+ on:
6
+ pull_request:
7
+ branches:
8
+ - "*"
9
+
10
+ jobs:
11
+ running-tests:
12
+ uses: kaltura/ovp-pipelines-pub/.github/workflows/player_tests.yaml@path
13
+ with:
14
+ yarn-run-to-execute: 'tgz build'
15
+ notification:
16
+ if: always()
17
+ uses: kaltura/ovp-pipelines-pub/.github/workflows/notification.yaml@path
18
+ needs: running-tests
19
+ secrets:
20
+ PLAYER_MSTEAMS_WEBHOOK: ${{ secrets.PLAYER_MSTEAMS_WEBHOOK }}
21
+ with:
22
+ failure-status: ${{ contains(needs.*.result, 'failure') }}
23
+ cancelled-status: ${{ contains(needs.*.result, 'cancelled') }}
24
+ is-test: 'true'
@@ -0,0 +1,15 @@
1
+ name: "Semantic PR title"
2
+ on:
3
+ pull_request_target:
4
+ types:
5
+ - opened
6
+ - edited
7
+ - synchronize
8
+
9
+ jobs:
10
+ main:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: amannn/action-semantic-pull-request@v3.4.0
14
+ env:
15
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### 0.4.10-canary.0-878cdb7 (2023-05-16)
package/README.md ADDED
@@ -0,0 +1,223 @@
1
+ # PlayKit JS Rapt Player - Interactive Player Plugin for the [Kaltura Player JS]
2
+
3
+ [![Build Status](https://github.com/kaltura/kaltura-interactive-player/actions/workflows/run_canary_full_flow.yaml/badge.svg)](https://github.com/kaltura/kaltura-interactive-player/actions/workflows/run_canary_full_flow.yaml)
4
+ [![](https://img.shields.io/npm/v/@playkit-js/rapt/latest.svg)](https://www.npmjs.com/package/@playkit-js/rapt)
5
+ [![](https://img.shields.io/npm/v/@playkit-js/rapt/canary.svg)](https://www.npmjs.com/package/@playkit-js/rapt/v/canary)
6
+
7
+
8
+ # rapt-player
9
+ 'Rapt' is an interactive way to consume video, where the end-user can make decisions along the video or navigate to
10
+ external web pages. We will use the term 'interactive-video' or IV (and KIP for Kaltura-Interactive-Player)
11
+
12
+ ## Description
13
+ The KIP is in fact a code that switches players at runtime. Each video node is loaded in its own player so
14
+ it caches the first few seconds of that video to get an immediate playback experience. The KIP receives
15
+ a rapt playlist-id as a starting-point, loads Rapt metadata (the mapping of the rapt project), loads the initial video,
16
+ places the Rapt-engine layer (the layer that shows the IV UI) and in the background caches the relevant videos. Once
17
+ the user interacts with the Rapt engine layer, the KIP will move the next video to the front and play it.
18
+
19
+
20
+ ## Install:
21
+ ```
22
+ git clone https://github.com/kaltura/kaltura-interactive-player.git
23
+ cd kaltura-interactive-player
24
+ npm install
25
+ ```
26
+
27
+ ## Dev setup
28
+ Since most Interactive Videos today are generated in MediaSpace™, they are KS protected. This means that the index.html
29
+ is expected to have a valid KS in it. The default entry is of partner-id 27017 and the hard-coded KS will expire around
30
+ Sep 23 2019. Please do not edit this entry as it is designed to cover many use cases.
31
+ The default index.html also has an example of how to embed a KIV, and how to integrate with it and listen to events
32
+
33
+
34
+ ## Run:
35
+ ```
36
+ npm start
37
+ ```
38
+
39
+ ## Embed:
40
+ This library will be bundled inside the Kaltura playkit-js library and served by it.
41
+ In most cases, KMS will generate the player uiconf for you, in case you create the player maually, you will need to make sure that the player V3 version incluses the Rapt V3 "plugin". You do that by setting the 'Additional flashvars' field to something that looks like this template:
42
+ ```
43
+ {"kaltura-ovp-player":"V3_PLAYER_VERSION","path" : "PATH_VERSION"}
44
+ ```
45
+ E.G. {"kaltura-ovp-player":"0.37.2","path" : "0.1.5"}
46
+
47
+ This next snippet will show a typical embed code of a rapt player
48
+
49
+ ```
50
+ <!-- playkit-js library code and Rapt -->
51
+ <script src="http://cdnapisec.kaltura.com/p/27017/embedPlaykitJs/uiconf_id/42897631"></script>
52
+
53
+ <!-- The div that hosts the rapt project-->
54
+ <div id="player"></div>
55
+
56
+ <!-- embed-code -->
57
+ <script>
58
+ // Rapt config
59
+ var config = {
60
+ targetId: 'player',
61
+ playback:{
62
+ autoplay:true,
63
+ preload:"auto"
64
+ },
65
+ provider: {
66
+ partnerId: 27017,
67
+ uiConfId: 43533251,
68
+ ks: "Zjk0YmQwZTRkZDFjOTE1MGEwMWYwMmEzYzE4ODI4ZTA1YzFkNjRjNHwyNzAxNzsyNzAxNzsxNTM1NzE5NTAyOzI7NzU0MztfX0FETUlOX18yNjY4NzsqLGRpc2FibGVlbnRpdGxlbWVudA=="
69
+ },
70
+ rapt:{}
71
+ };
72
+ var raptPlayer = PathKalturaPlayer.setup(config);
73
+ raptPlayer.loadMedia({playlistId: '1_4377j2jl'});
74
+
75
+ </script>
76
+ ```
77
+
78
+
79
+ ## Configrations:
80
+ The Rapt configuration is in fact an extension of the playkit-js configuration with the addition of the rapt section.
81
+
82
+ ## API
83
+ #####Event Listening:
84
+ The embed code shows how to create a Rapt-player instance. Once you have that instance you can listen to events and
85
+ query the player for information
86
+
87
+ Assuming the name of the player instance is 'raptPlayer' like the demo, here's how to add listeners to it:
88
+
89
+ raptPlayer.addListener(EVENT_TYPE, event => {
90
+
91
+ })
92
+
93
+ Some events has payload, some don't. Her's an example for listening to a hotspot click, and retrieving
94
+ the hotspot object from the payload, which is the hotspot object
95
+ ```
96
+ raptPlayer.addListener("hotspot:click", event => {
97
+ const hotspot = event.payload;
98
+ /* E.G.
99
+ {
100
+ "id": "24070b0a-c332-4a89-bb4f-27114a7eb94c",
101
+ "name": "Snail",
102
+ "nodeId": "e14d8699-52dc-495c-bf25-6cf49e71dec1",
103
+ "label": "Snail",
104
+ "showAt": 0,
105
+ "hideAt": 1,
106
+ "style": {...},
107
+ "position": {
108
+ "left": 30,
109
+ "top": 27,
110
+ "width": 133,
111
+ "height": 57
112
+ },
113
+ "onClick": [],
114
+ "customData": null
115
+ }
116
+ */
117
+ })
118
+ ```
119
+ Another common action is to know when a node is played:
120
+ ```
121
+ raptPlayer.addListener("node:enter", event => {
122
+ const node = event.payload;
123
+ /* E.G.
124
+ {
125
+ "id": "e14d8699-52dc-495c-bf25-6cf49e71dec1",
126
+ "xref": null,
127
+ "name": "Hens",
128
+ "customData": "whatever",
129
+ "entryId": "1_b29y3jnj",
130
+ "onEnded": [{
131
+ "type": "project:stop",
132
+ "payload": {}
133
+ }],
134
+ "prefetchNodeIds": []
135
+ }
136
+ */
137
+
138
+ })
139
+ ```
140
+
141
+
142
+ ####Events
143
+ Event String | Description | Payload
144
+ -------------- | --------------- | --------
145
+ browser:hidden | when the player focuses a new tab |
146
+ browser:open | when the player focuses a new tab |
147
+ cue:forward | when a node goes pass a code-cue point |
148
+ cue:reverse | when a node goes back a code-cue point |
149
+ hotspot:click | user clicked a hotspot | the hotspot object
150
+ node:enter | A node started to play | the node object that had started to play
151
+ node:ended | A node had reached its end | the node object that reached the end of video
152
+ node:exit | when a user left a node | the node object that was left to another node
153
+ project:load | triggered once when the player loaded |
154
+ project:ready | triggered when the data was loaded |
155
+ project:start | triggered when the start-node had started playing |
156
+
157
+ ####Query Rapt data
158
+ We can access the rapt raw data, as it is saved on the database by writing this phrase:
159
+
160
+ ```
161
+ raptPlayer.data
162
+
163
+ // print all hotspots
164
+ console.table(raptPlayer.data.hotspots);
165
+
166
+ // print all nodes
167
+ console.table(raptPlayer.data.nodes);
168
+
169
+ // get the starting node id
170
+ console.log(raptPlayer.data.settings.startNodeId);
171
+ ```
172
+ ####Commands
173
+ We can command the player to preform some playback actions (on the current played video) and also to tell the rapt player
174
+ to "jump" to a different node.
175
+
176
+ Here are the supported actions:
177
+ ```
178
+ raptPlayer.pause(); // pause current video
179
+ raptPlayer.play(); // play current video
180
+ raptPlayer.seek(50); // seek the current video to sec 50
181
+ raptPlayer.volume(0); mute the player (will effect all next nodes as well)
182
+ raptPlayer.jump({name:'Start'}); // Switch the content to play a node that has the name 'start'
183
+ raptPlayer.jump({id:'7354fd9b-6401-4c10-b261-99b4d183d07e'}); // Switch the content to play a node that has the given id
184
+ ```
185
+
186
+ ## Limitations
187
+ Iphone cannot buffer less than 30 minutes of video, meaning that it will consume a big bandwidth.
188
+ For iphone we have disabled the pre-buffering mechanism.
189
+
190
+ ### Locked kaltura player version
191
+ > Kaltura Player must be 0.47.8 (Relies on internal API that might not be guarantee forward comp')
192
+ - [ ] Black-rectangle hides the player when no thumbnail - used CSS to hide it (Rapt-217)
193
+ - [ ] __kalturaplayerdata.UIConf (Kip.ts) to read uiconf data
194
+ - [ ] Open a pull request
195
+
196
+
197
+ ### Licensing
198
+ This project is licensed under the AGPL-3.0 License - see the LICENSE.md file for details
199
+
200
+
201
+ ## How to Release
202
+ 1. Go to package.json file and change the version
203
+ 2. Go to version.ts file and change the version
204
+ 3. Commit and Push with a message "chore(bump): bump to version $VERSION"
205
+ 4. Run ```
206
+ npm tag
207
+ ```
208
+ , or create a new tag via github
209
+ 5. Run ```
210
+ npm build
211
+ ```
212
+ 6. Run ```
213
+ npm tgz
214
+ ```
215
+ , this will output a tar.gz file in dist folder
216
+ 7. Go to the new tag in github and click on Edit and add the tar.gz file from dist folder
217
+
218
+
219
+ ## Deployment Instructions
220
+ Extract the tgz files into a folder by the name of the version, in all bundle machines
221
+ (E.G. /opt/kaltura/html5/html5lib/playkitSources/rapt/0.4.6/). The output is 2 files on that folder.
222
+
223
+ Alternatively - copy the 2 files directly from the release (.js and .js.map) to the relevant folder.
package/docs/API.md ADDED
@@ -0,0 +1,222 @@
1
+ # API
2
+ The API of the Kaltura Interactive Player is constructed to 2 main options. You can listen to player events, and you can command the player to preform an action.
3
+
4
+ ## [Commanding the player](#Commands)
5
+ The API of the player in fact a reflection of playkit-js API and can be seen here:
6
+ https://github.com/kaltura/playkit-js
7
+
8
+ Example:
9
+ ```
10
+ // setup
11
+ var kalturaInteractivePlayer = Kip.setup(config);
12
+
13
+ // Media-load
14
+ kalturaInteractivePlayer.loadMedia({ "entryId" : "0_dm5h0dD" });
15
+
16
+ // play the current video
17
+ kalturaInteractivePlayer.play();
18
+
19
+ // pause the current video
20
+ kalturaInteractivePlayer.pause();
21
+
22
+ // Set volume to 50%
23
+ kalturaInteractivePlayer.volume = 0.5;
24
+
25
+ // Seek current video to sec 10
26
+ kalturaInteractivePlayer.seek(10);
27
+
28
+ ```
29
+
30
+ ## [Extracting data from the player]()
31
+ Once we have a reference to the player we can just use one of the getters function to access the data
32
+
33
+ Example:
34
+ ```
35
+ // setup
36
+ var kalturaInteractivePlayer = Kip.setup(config);
37
+
38
+ // Media-load
39
+ kalturaInteractivePlayer.loadMedia({ "entryId" : "0_dm5h0dD" });
40
+
41
+ // get the current video playhead-position
42
+ const currentTime = kalturaInteractivePlayer.currentTime
43
+
44
+ // get the current video volume
45
+ const currentVolume = kalturaInteractivePlayer.volume
46
+
47
+ ```
48
+
49
+ ## [Events Listening](#Events)
50
+
51
+ Events are published from the player and can be subscribed to in order to extend the interactive experience or inform analytics services.
52
+ Every event is an object with type and payload properties.
53
+ The payload property will return information about the project, it’s current state, and, depending on the event, custom data fed from fields in the Rapt Media composer.
54
+
55
+ Example:
56
+ ```
57
+ // setup
58
+ var kalturaInteractivePlayer = Kip.setup(config);
59
+ // Event listening
60
+ kalturaInteractivePlayer.addListener("project:load" , function (event) {
61
+ console.log(event.type); // project:load
62
+ console.log(event.payload); // project:load
63
+ });
64
+ // Media-load
65
+ kalturaInteractivePlayer.loadMedia({ "entryId" : "0_dm5h0dD" });
66
+
67
+ ```
68
+ <br/>
69
+
70
+ ## Commands
71
+
72
+ #### function play();
73
+ Play the current video
74
+
75
+ #### function pause();
76
+ Pause the current video
77
+
78
+ #### function seek(n);
79
+ Seek current video to a specific second.
80
+
81
+ #### function volume(n);
82
+ Set the volume of the player. value need to be between 0 to 1.
83
+
84
+ ## Events
85
+ #### project:load
86
+ A new project is loading. Project data will not be available.
87
+ ##### payload
88
+ None
89
+
90
+ #### project:ready
91
+ A new project has been loaded.
92
+ ##### payload
93
+ None
94
+
95
+ #### project:start
96
+ The project has started. Triggered on the first media play event of a given play through (will re-trigger on replay’s).
97
+ ##### payload
98
+ None
99
+
100
+ #### project:ended
101
+ The project has reached the end of a given branching structure.
102
+ ##### payload
103
+ None
104
+
105
+ #### project:replay
106
+ The project is being reset for replay.
107
+ ##### payload
108
+ None
109
+
110
+ #### project:unload
111
+ The project has been unloaded.
112
+ ##### payload
113
+ None
114
+
115
+ #### project:reset
116
+ The project has been reset to the beginning.
117
+ ##### payload
118
+ None
119
+
120
+ #### node:enter
121
+ A new node has been loaded.
122
+ ##### payload
123
+ kind - only on the 1st node will be "start". All other will be "jump"
124
+ ```
125
+ {
126
+ kind: "jump" || "start" ,
127
+ node: [THE_NODE_OBJECT],
128
+ prevNode: [THE_PREVIOUS_NODE] / undefine in case of first node
129
+ }
130
+ ```
131
+
132
+ #### node:exit
133
+ The current node will be unloaded.
134
+ ##### payload
135
+ ```
136
+ {
137
+ kind: "jump",
138
+ node: [THE_NODE_OBJECT],
139
+ nextNode: [THE_NEXT_NODE]
140
+ }
141
+ ```
142
+
143
+ #### node:ended
144
+ The current node has ended.
145
+ ##### payload
146
+ ```
147
+ {
148
+ kind: [THE_NODE_NAME],
149
+ node: [THE_NODE_OBJECT],
150
+ prevNode: [THE_PREVIOUS_NODE] / undefine in case of first node
151
+ }
152
+ ```
153
+
154
+ #### hotspot:click
155
+ The user has clicked on a hotspot.
156
+ ##### payload
157
+ ```
158
+ {
159
+ hotspot: [THE_HOTSPOT_OBJECT]
160
+ }
161
+ ```
162
+
163
+ #### browser:open
164
+ The project has opened a new window.
165
+ ##### payload
166
+ ```
167
+ {
168
+ href: [URL_TO_OPEN],
169
+ target: "_blank"
170
+ }
171
+ ```
172
+
173
+ #### browser:hidden
174
+ The browser window has been hidden. The interactive video will be paused.
175
+ ##### payload
176
+ None
177
+
178
+ #### cue:forward
179
+ Playback has crossed over a cue point. Cue points are custom api events that can be added using the Rapt Media composer by entering the node editor and turning on the api event timeline. Custom data can be added to each cue point and is passed through in the payloadproperty.
180
+ ##### payload
181
+ ```
182
+ {
183
+ cue: {
184
+ customData : [THE_CUEPOINT_STRING],
185
+ id : [THE_CUEPOINT_ID]
186
+ }
187
+ }
188
+ ```
189
+
190
+ #### cue:reverse
191
+ Playback has reversed passed a cue point. Cue points are custom api events that can be added using the Rapt Media composer by entering the node editor and turning on the api event timeline. Custom data can be added to each cue point and is passed through in the payload property.
192
+ ##### payload
193
+ ```
194
+ {
195
+ cue: {
196
+ customData : [THE_CUEPOINT_STRING],
197
+ id : [THE_CUEPOINT_ID]
198
+ }
199
+ }
200
+ ```
201
+
202
+ #### player:play
203
+ The current video has started playing.
204
+ ##### payload
205
+ None
206
+
207
+ #### player:pause
208
+ The current video has been paused.
209
+ ##### payload
210
+ None
211
+
212
+ #### player:progress
213
+ The playhead has crossed a predefined progress point. Event fires at 25%, 50%, 75% and 98% of every node.
214
+ ##### payload
215
+ The percentage are in format of decimal fraction (E.G. 0.5 = 50%)
216
+ ```
217
+ {
218
+ progress: [DECIMAL_PERCENTAGE]
219
+ }
220
+ ```
221
+
222
+