@gumlet/insights-js-core 1.0.3 → 1.1.0
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.
- package/.github/workflows/main.yml +87 -0
- package/.gitlab-ci.yml +54 -0
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/bitbucket-pipelines.yml +35 -0
- package/docs/payload-documentation.md +72 -0
- package/html/bitmovin.html +82 -0
- package/html/dashjs.html +55 -0
- package/html/hlsjs.html +72 -0
- package/html/html5.html +59 -0
- package/html/shaka.html +102 -0
- package/html/videojs.html +67 -0
- package/index.html +73 -0
- package/jest.config.js +187 -0
- package/js/adapters/Bitmovin7Adapter.js +352 -0
- package/js/adapters/BitmovinAdapter.js +198 -0
- package/js/adapters/DashjsAdapter.js +140 -0
- package/js/adapters/HTML5Adapter.js +774 -0
- package/js/adapters/HlsjsAdapter.js +152 -0
- package/js/adapters/ShakaAdapter.js +81 -0
- package/js/adapters/VideoJsAdapter.js +455 -0
- package/js/analyticsStateMachines/Bitmovin7AnalyticsStateMachine.js +471 -0
- package/js/analyticsStateMachines/BitmovinAnalyticsStateMachine.js +299 -0
- package/js/analyticsStateMachines/HTML5AnalyticsStateMachine.js +443 -0
- package/js/analyticsStateMachines/VideoJsAnalyticsStateMachine.js +503 -0
- package/js/cast/CastClient.js +50 -0
- package/js/cast/CastReceiver.js +37 -0
- package/js/core/AdapterFactory.js +41 -0
- package/js/core/Analytics.js +1357 -0
- package/js/core/AnalyticsStateMachineFactory.js +36 -0
- package/js/core/GumletInsightsExport.js +75 -0
- package/js/enums/CDNProviders.js +11 -0
- package/js/enums/Events.js +32 -0
- package/js/enums/GumletEnum.js +19 -0
- package/js/enums/MIMETypes.js +30 -0
- package/js/enums/Players.js +11 -0
- package/js/enums/StreamTypes.js +15 -0
- package/js/utils/EventsCall.js +22 -0
- package/js/utils/HttpCall.js +57 -0
- package/js/utils/LicenseCall.js +18 -0
- package/js/utils/Logger.js +40 -0
- package/js/utils/PlayerDetector.js +75 -0
- package/js/utils/PlayerInitCall.js +22 -0
- package/js/utils/SessionCreationCall.js +22 -0
- package/js/utils/Settings.js +3 -0
- package/js/utils/Utils.js +195 -0
- package/package.json +62 -1
- package/precommit.bash +8 -0
- package/tests/stage1.test.js +50 -0
- package/webpack.config.debug.js +34 -0
- package/webpack.config.js +40 -0
- package/webpack.config.release.js +62 -0
- package/gumlet-insights.min.js +0 -2
- package/gumlet-insights.min.js.LICENSE.txt +0 -10
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
name: Test and deploy
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags:
|
|
5
|
+
- "*"
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
# test:
|
|
9
|
+
# runs-on: ubuntu-20.04
|
|
10
|
+
|
|
11
|
+
# steps:
|
|
12
|
+
# - uses: actions/checkout@v3
|
|
13
|
+
# - uses: actions/setup-node@v3
|
|
14
|
+
# with:
|
|
15
|
+
# node-version: 16
|
|
16
|
+
|
|
17
|
+
# - name: Test
|
|
18
|
+
# run: |
|
|
19
|
+
# sudo apt-get update
|
|
20
|
+
# sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev
|
|
21
|
+
# npm ci
|
|
22
|
+
# npm test
|
|
23
|
+
|
|
24
|
+
build_and_publish:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
# needs: [test]
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v3
|
|
30
|
+
- uses: actions/setup-node@v3
|
|
31
|
+
with:
|
|
32
|
+
node-version: 16
|
|
33
|
+
registry-url: 'https://registry.npmjs.org'
|
|
34
|
+
- name: Build
|
|
35
|
+
run: |
|
|
36
|
+
npm ci
|
|
37
|
+
npm run build:release
|
|
38
|
+
npm publish
|
|
39
|
+
env:
|
|
40
|
+
NODE_ENV: "production"
|
|
41
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
42
|
+
|
|
43
|
+
- name: Upload artifact
|
|
44
|
+
uses: actions/upload-artifact@v3
|
|
45
|
+
with:
|
|
46
|
+
name: insights-js-core-build
|
|
47
|
+
path: build/
|
|
48
|
+
retention-days: 5
|
|
49
|
+
|
|
50
|
+
deploy_to_s3:
|
|
51
|
+
runs-on: ubuntu-20.04
|
|
52
|
+
needs: [build_and_publish]
|
|
53
|
+
|
|
54
|
+
steps:
|
|
55
|
+
- name: Download artifacts
|
|
56
|
+
uses: actions/download-artifact@v3
|
|
57
|
+
with:
|
|
58
|
+
name: insights-js-core-build
|
|
59
|
+
path: ./build
|
|
60
|
+
|
|
61
|
+
- name: Set up Python
|
|
62
|
+
uses: actions/setup-python@v3
|
|
63
|
+
with:
|
|
64
|
+
python-version: '3.10'
|
|
65
|
+
|
|
66
|
+
- name: Deploy to S3
|
|
67
|
+
run: |
|
|
68
|
+
pip install awscli
|
|
69
|
+
aws s3 cp ./build/release/ s3://gumlet-cdn/insights/1.0/ --cache-control "public, s-maxage=31536000, max-age=172800" --region us-east-1 --recursive --acl public-read
|
|
70
|
+
curl -X PURGE -H Fastly-Key:$FASTLY_API_TOKEN https://cdn.gumlytics.com/insights/1.0/gumlet-insights.min.js
|
|
71
|
+
env:
|
|
72
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
73
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
74
|
+
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
- name: Slack Notification
|
|
78
|
+
if: always()
|
|
79
|
+
uses: rtCamp/action-slack-notify@v2
|
|
80
|
+
env:
|
|
81
|
+
SLACK_WEBHOOK: https://hooks.slack.com/services/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
|
|
82
|
+
SLACK_USERNAME: Github-Slack
|
|
83
|
+
SLACK_ICON_EMOJI: ":cat:"
|
|
84
|
+
SLACK_COLOR: ${{ job.status }}
|
|
85
|
+
SLACK_TITLE: ${{ github.repository }}:${{github.ref_name}}
|
|
86
|
+
SLACK_MESSAGE: ${{ job.status }}
|
|
87
|
+
SLACK_FOOTER: ""
|
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
# - test
|
|
3
|
+
- build
|
|
4
|
+
- deploy
|
|
5
|
+
|
|
6
|
+
# test_js:
|
|
7
|
+
# stage: test
|
|
8
|
+
# image: node:16
|
|
9
|
+
# script:
|
|
10
|
+
# - apt-get update && apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev
|
|
11
|
+
# - npm ci
|
|
12
|
+
# - npm test
|
|
13
|
+
# rules:
|
|
14
|
+
# - if: '$CI_COMMIT_TAG == "prod"'
|
|
15
|
+
|
|
16
|
+
build_js:
|
|
17
|
+
stage: build
|
|
18
|
+
image: node:16
|
|
19
|
+
script:
|
|
20
|
+
- npm ci
|
|
21
|
+
- npm run build:release
|
|
22
|
+
artifacts:
|
|
23
|
+
paths:
|
|
24
|
+
- build/
|
|
25
|
+
expire_in: 1 day
|
|
26
|
+
only:
|
|
27
|
+
- tags
|
|
28
|
+
except:
|
|
29
|
+
- branches
|
|
30
|
+
|
|
31
|
+
deploy_to_npm:
|
|
32
|
+
stage: deploy
|
|
33
|
+
image: node:16
|
|
34
|
+
script:
|
|
35
|
+
- 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
|
|
36
|
+
- cd build/release/ && npm publish --access public
|
|
37
|
+
only:
|
|
38
|
+
- tags
|
|
39
|
+
except:
|
|
40
|
+
- branches
|
|
41
|
+
|
|
42
|
+
deploy_to_s3:
|
|
43
|
+
stage: deploy
|
|
44
|
+
image: python:3.9
|
|
45
|
+
script:
|
|
46
|
+
- apt-get update && apt-get install -y curl
|
|
47
|
+
- pip install awscli
|
|
48
|
+
- aws s3 cp ./build/release/ s3://gumlet-cdn/insights/1.0/ --cache-control "public, s-maxage=31536000, max-age=172800" --region us-east-1 --recursive --acl public-read
|
|
49
|
+
- curl -X PURGE -H Fastly-Key:$FASTLY_API_TOKEN https://cdn.gumlytics.com/insights/1.0/gumlet-insights.min.js
|
|
50
|
+
only:
|
|
51
|
+
- tags
|
|
52
|
+
except:
|
|
53
|
+
- branches
|
|
54
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Gumlet Pte. Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Gumlet Analytics Collector
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
* Node >= 8.x
|
|
6
|
+
* Yarn package manager: https://yarnpkg.com
|
|
7
|
+
|
|
8
|
+
NOTE: `npm` will also work with the same scripts added the `run ...` command.
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
yarn install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Build scripts
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
yarn build:debug
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
yarn build:release
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Dev mode
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
yarn start // run webpack-dev-server
|
|
30
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
pipelines:
|
|
2
|
+
tags:
|
|
3
|
+
'*':
|
|
4
|
+
# - step:
|
|
5
|
+
# name: Test
|
|
6
|
+
# image: node:16
|
|
7
|
+
# caches:
|
|
8
|
+
# - node
|
|
9
|
+
# script:
|
|
10
|
+
# - apt-get update
|
|
11
|
+
# - apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev
|
|
12
|
+
# - npm ci
|
|
13
|
+
# - npm test
|
|
14
|
+
- step:
|
|
15
|
+
name: Build and Publish
|
|
16
|
+
image: node:16
|
|
17
|
+
caches:
|
|
18
|
+
- node
|
|
19
|
+
artifacts:
|
|
20
|
+
- build/**
|
|
21
|
+
script:
|
|
22
|
+
- 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
|
|
23
|
+
- export NODE_ENV="production"
|
|
24
|
+
- npm ci
|
|
25
|
+
- npm run build:release
|
|
26
|
+
- npm publish
|
|
27
|
+
- step:
|
|
28
|
+
name: Deploy to S3
|
|
29
|
+
image: python:3.10
|
|
30
|
+
caches:
|
|
31
|
+
- pip
|
|
32
|
+
script:
|
|
33
|
+
- pip install awscli
|
|
34
|
+
- aws s3 cp ./build/release/ s3://gumlet-cdn/insights/1.1/ --cache-control "public, s-maxage=31536000, max-age=172800" --region us-east-1 --recursive --acl public-read
|
|
35
|
+
- curl -X PURGE -H Fastly-Key:$FASTLY_API_TOKEN https://cdn.gumlytics.com/insights/1.1/gumlet-insights.min.js
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Analytics Payload Documentation
|
|
2
|
+
|
|
3
|
+
Bitmovin Analytics collects information about playback behavior in samples. Each sample has a `timestamp` as well as a `duration` and thus represents a chunk of time that passed on the client in which the player was in a distinct state.
|
|
4
|
+
|
|
5
|
+
To illustrate here is the beginning of a typical session while the player is going through the different states. Each line represents one JSON payload that gets sent back to the client.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
player startup: +----+
|
|
9
|
+
video startup: +-+
|
|
10
|
+
video playback @500kbps: +--------+
|
|
11
|
+
video playback @1mbps: +---------+
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
If we look at the first sample the json payload would contain the following information:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
time: <client timestamp>
|
|
18
|
+
state: 'startup'
|
|
19
|
+
duration: 300ms
|
|
20
|
+
playerStartupTime: 300ms
|
|
21
|
+
videoStartupTime: 0ms
|
|
22
|
+
videoBitrate: 0
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The second sample that represents the video startup would therefore look like this:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
time: <client timestamp>
|
|
29
|
+
state: 'video startup'
|
|
30
|
+
duration: 60ms
|
|
31
|
+
playerStartupTime: 0
|
|
32
|
+
videoStartupTime: 60ms
|
|
33
|
+
videoBitrate: 0
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
and the third that represents the initial playout at 500 kbps over 1 second:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
time: <client timestamp>
|
|
40
|
+
state: 'playing'
|
|
41
|
+
duration: 1000ms
|
|
42
|
+
playerStartupTime: 0
|
|
43
|
+
videoStartupTime: 0
|
|
44
|
+
videoBitrate: 500000
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
as well as the last sample that gets sent after the quality switch up:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
time: <client timestamp>
|
|
51
|
+
state: 'playing'
|
|
52
|
+
duration: 1000ms
|
|
53
|
+
playerStartupTime: 0
|
|
54
|
+
videoStartupTime: 0
|
|
55
|
+
videoBitrate: 1000000
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
As you can see a lot of fields with `0` are being sent subsequently. The JSON payload always has the same fields, but depending on the state the player is in they are either set or not. There are some fields that are always set, notably the custom data fields like `videoId`, `cdnProvider`, `customData1-5` as well as fields that don't represent a distinct state change but rather information about the state of the player during the current sample, regardless of it's state like `streamFormat` (which stream technology was used, DASH/HLS or Progressive) or the `playerTech` (either native, html5 or flash).
|
|
59
|
+
|
|
60
|
+
A full list of the JSON payload fields and their description can be found here:
|
|
61
|
+
|
|
62
|
+
[Payload Field Documentation](https://docs.google.com/spreadsheets/d/1sSFGtKfOS-efQFDB6FFbNPYFXUnauHBqhyP5AFt4ZJA/edit?usp=sharing)
|
|
63
|
+
|
|
64
|
+
All these fields need to be supplied with the right datatype for the ingest to accept them.
|
|
65
|
+
|
|
66
|
+
## Custom Integrations
|
|
67
|
+
|
|
68
|
+
When developing a custom integration we strongly recommend you follow roughly the same model as the web collector. The code is open source and can be viewed on GitHub: [bitmovin-analytics-collector](https://github.com/bitmovin/bitmovin-analytics-collector)
|
|
69
|
+
|
|
70
|
+
The web collector follows the following approach:
|
|
71
|
+
|
|
72
|
+
A core class that maintains the current analytics sample that will be sent to the server once an event happens. This sample contains all the background non-event based information about the state we discussed earlier (streamFormat, videoId etc..). A state machine keeps is hooked up to the player events and whenever the state machine transitions to a new state the current analytics sample is being sent off to the server along with the relevant information from the state transition.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
|
|
6
|
+
<link rel="icon" href="https://ox4zindgwb3p1qdp2lznn7zb-wpengine.netdna-ssl.com/wp-content/uploads/2016/02/cropped-icon-32x32.png" sizes="32x32" />
|
|
7
|
+
<link rel="icon" href="https://ox4zindgwb3p1qdp2lznn7zb-wpengine.netdna-ssl.com/wp-content/uploads/2016/02/cropped-icon-192x192.png" sizes="192x192" />
|
|
8
|
+
<link rel="apple-touch-icon-precomposed" href="https://ox4zindgwb3p1qdp2lznn7zb-wpengine.netdna-ssl.com/wp-content/uploads/2016/02/cropped-icon-180x180.png" />
|
|
9
|
+
<meta name="msapplication-TileImage" content="https://bitmovin.com/wp-content/uploads/2016/02/cropped-icon-270x270.png" />
|
|
10
|
+
|
|
11
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous" />
|
|
12
|
+
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous">
|
|
13
|
+
</script>
|
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous">
|
|
15
|
+
</script>
|
|
16
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous">
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<title>Bitdash Analytics</title>
|
|
20
|
+
|
|
21
|
+
<!-- <script type="text/javascript" src="//bitmovin-a.akamaihd.net/bitmovin-player/stable/7.5/bitmovinplayer.js"></script> -->
|
|
22
|
+
<script type="text/javascript" src="//bitmovin-a.akamaihd.net/bitmovin-player/stable/8/bitmovinplayer.js"></script>
|
|
23
|
+
<script type="text/javascript" src="/build/debug/gumlet-insights.min.js"></script>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
<div id="player" style="width: 400px"></div>
|
|
27
|
+
<a href="bitmovin.html">Click</a>
|
|
28
|
+
<a href="#" id="click">Click</a>
|
|
29
|
+
<script type="text/javascript">
|
|
30
|
+
|
|
31
|
+
/* global bitmovin */
|
|
32
|
+
|
|
33
|
+
var config = {
|
|
34
|
+
// Your bitmovin analytics key
|
|
35
|
+
// TODO: remove the key after testing
|
|
36
|
+
key: 'e73a3577-d91c-4214-9e6d-938fb936818a',
|
|
37
|
+
property_id: '6Xlq31eG',
|
|
38
|
+
// Your player key (bitmovin, jw, ..) (optional)
|
|
39
|
+
playerKey: 'a6e31908-550a-4f75-b4bc-a9d89880a733',
|
|
40
|
+
player: gumlet.insights.Players.BITMOVIN,
|
|
41
|
+
cdnProvider: gumlet.insights.CdnProviders.AKAMAI,
|
|
42
|
+
debug: true,
|
|
43
|
+
customData1: 'customData1',
|
|
44
|
+
customData2: 'customData2',
|
|
45
|
+
experimentName: 'bitmovinanalytics-local',
|
|
46
|
+
videoId: 'Sintel',
|
|
47
|
+
userId: 'customer#1'
|
|
48
|
+
};
|
|
49
|
+
var analytics = gumlet.insights(config);
|
|
50
|
+
|
|
51
|
+
var conf = {
|
|
52
|
+
key: 'a6e31908-550a-4f75-b4bc-a9d89880a733',
|
|
53
|
+
playback: {
|
|
54
|
+
autoplay: true
|
|
55
|
+
},
|
|
56
|
+
source: {
|
|
57
|
+
dash: 'http://bitdash-a.akamaihd.net/content/sintel/sintel.mpd',
|
|
58
|
+
hls: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
|
|
59
|
+
progressive: [{
|
|
60
|
+
url: 'https://bitdash-a.akamaihd.net/content/MI201109210084_1/MI201109210084_mpeg-4_hd_high_1080p25_10mbits.mp4',
|
|
61
|
+
type: 'video/mp4'
|
|
62
|
+
}]
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var player = bitmovin.player('player');
|
|
66
|
+
player.setup(conf);
|
|
67
|
+
|
|
68
|
+
analytics.register(player);
|
|
69
|
+
|
|
70
|
+
document.getElementById('click').onclick = function () {
|
|
71
|
+
analytics.setCustomDataOnce({ customData1: 'after-click' });
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// window.setTimeout(function () {
|
|
75
|
+
// player.load({
|
|
76
|
+
// hls: "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8",
|
|
77
|
+
// });
|
|
78
|
+
// }, 5000)
|
|
79
|
+
|
|
80
|
+
</script>
|
|
81
|
+
</body>
|
|
82
|
+
</html>
|
package/html/dashjs.html
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
|
|
6
|
+
<link rel="icon" href="https://assets.gumlet.io/assets/round-logo.png?w=32" sizes="32x32" />
|
|
7
|
+
<link rel="icon" href="https://assets.gumlet.io/assets/round-logo.png?w=192" sizes="192x192" />
|
|
8
|
+
<link rel="apple-touch-icon-precomposed" href="https://assets.gumlet.io/assets/round-logo.png?w=180" />
|
|
9
|
+
<meta name="msapplication-TileImage" content="https://assets.gumlet.io/assets/round-logo.png?w=270" />
|
|
10
|
+
|
|
11
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous" />
|
|
12
|
+
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous">
|
|
13
|
+
</script>
|
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous">
|
|
15
|
+
</script>
|
|
16
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous">
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<title>DashJS Player Insights</title>
|
|
20
|
+
|
|
21
|
+
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/dashjs/2.6.6/dash.all.debug.js"></script> -->
|
|
22
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.1.0/dash.all.debug.min.js"></script>
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" src="/build/debug/gumlet-insights.min.js"></script>
|
|
25
|
+
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<div id="player" style="width: 400px"></div>
|
|
29
|
+
|
|
30
|
+
<video id="my-video" preload="none" width="640" height="264" controls></video>
|
|
31
|
+
|
|
32
|
+
<p><a href="/html/dashjs.html">Click</a></p>
|
|
33
|
+
|
|
34
|
+
<script type="text/javascript">
|
|
35
|
+
|
|
36
|
+
var config = {
|
|
37
|
+
property_id: 'BNVzRZKD',
|
|
38
|
+
customData1: 'some custom data',
|
|
39
|
+
customData2: 'customData2',
|
|
40
|
+
videoId: 'Sintel',
|
|
41
|
+
userId: 'customer#1'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var analytics = gumlet.insights(config);
|
|
45
|
+
var url = "https://video.gumlet.io/5f462c1561cf8a766464ffc4/61dd877c6ec832ab2aaa1837/7.mpd";
|
|
46
|
+
var player = dashjs.MediaPlayer().create();
|
|
47
|
+
|
|
48
|
+
analytics.registerDashJSPlayer(player);
|
|
49
|
+
|
|
50
|
+
player.initialize(document.querySelector("#my-video"), url, true);
|
|
51
|
+
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
package/html/hlsjs.html
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
|
|
6
|
+
<link rel="icon" href="https://assets.gumlet.io/assets/round-logo.png?w=32" sizes="32x32" />
|
|
7
|
+
<link rel="icon" href="https://assets.gumlet.io/assets/round-logo.png?w=192" sizes="192x192" />
|
|
8
|
+
<link rel="apple-touch-icon-precomposed" href="https://assets.gumlet.io/assets/round-logo.png?w=180" />
|
|
9
|
+
<meta name="msapplication-TileImage" content="https://assets.gumlet.io/assets/round-logo.png?w=270" />
|
|
10
|
+
|
|
11
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous" />
|
|
12
|
+
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous">
|
|
13
|
+
</script>
|
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous">
|
|
15
|
+
</script>
|
|
16
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous">
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<title>HlsJS Player Insights</title>
|
|
20
|
+
|
|
21
|
+
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/hls.js/0.7.11/hls.min.js"></script> -->
|
|
22
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.1.1/hls.min.js"></script>
|
|
23
|
+
<script type="text/javascript" src="/build/debug/gumlet-insights.min.js"></script>
|
|
24
|
+
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<div id="player" style="width: 400px"></div>
|
|
28
|
+
|
|
29
|
+
<video id="my-video" preload="true" autoplay width="640" height="264" controls></video>
|
|
30
|
+
|
|
31
|
+
<p><a href="/html/hlsjs.html">Click</a></p>
|
|
32
|
+
|
|
33
|
+
<script type="text/javascript">
|
|
34
|
+
|
|
35
|
+
var config = {
|
|
36
|
+
property_id: 'BNVzRZKD',
|
|
37
|
+
debug: true,
|
|
38
|
+
customData1: 'customData1',
|
|
39
|
+
customData2: 'customData2',
|
|
40
|
+
videoId: 'Sintel',
|
|
41
|
+
userId: 'customer#1'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var analytics = gumlet.insights(config);
|
|
45
|
+
|
|
46
|
+
if(Hls.isSupported()) {
|
|
47
|
+
|
|
48
|
+
var video = document.getElementById('my-video');
|
|
49
|
+
var time = new Date().getTime();
|
|
50
|
+
var hls = new Hls({
|
|
51
|
+
// disable preload
|
|
52
|
+
autoStartLoad: true
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
analytics.registerHLSJSPlayer(hls, {starttime: time});
|
|
56
|
+
|
|
57
|
+
hls.attachMedia(video);
|
|
58
|
+
hls.loadSource('https://video.gumlet.io/5f462c1561cf8a766464ffc4/61b8ac77b7e0439691e7c2af/1.m3u8');
|
|
59
|
+
|
|
60
|
+
video.addEventListener('play', function() {
|
|
61
|
+
// needed for when preload disabled
|
|
62
|
+
hls.startLoad();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
} else {
|
|
66
|
+
window.alert('Hls.js can not run in this browser');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
</body>
|
|
72
|
+
</html>
|
package/html/html5.html
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
|
|
6
|
+
<link rel="icon" href="https://assets.gumlet.io/assets/round-logo.png?w=32" sizes="32x32" />
|
|
7
|
+
<link rel="icon" href="https://assets.gumlet.io/assets/round-logo.png?w=192" sizes="192x192" />
|
|
8
|
+
<link rel="apple-touch-icon-precomposed" href="https://assets.gumlet.io/assets/round-logo.png?w=180" />
|
|
9
|
+
<meta name="msapplication-TileImage" content="https://assets.gumlet.io/assets/round-logo.png?w=270" />
|
|
10
|
+
|
|
11
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous" />
|
|
12
|
+
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous">
|
|
13
|
+
</script>
|
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous">
|
|
15
|
+
</script>
|
|
16
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous">
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<title>HTML5 Player Insights</title>
|
|
20
|
+
|
|
21
|
+
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/dashjs/2.6.6/dash.all.debug.js"></script> -->
|
|
22
|
+
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.1.0/dash.all.debug.min.js"></script> -->
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" src="/build/debug/gumlet-insights.min.js"></script>
|
|
25
|
+
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<div id="player" style="width: 400px">
|
|
29
|
+
|
|
30
|
+
<video id="my-video" preload="none" autoplay controls style="width:100%;">
|
|
31
|
+
<source src="https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.mp4" type="video/mp4">
|
|
32
|
+
</video>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<p><a href="dashjs.html">Click</a></p>
|
|
36
|
+
|
|
37
|
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.15.0/videojs-contrib-hls.min.js"></script>
|
|
38
|
+
|
|
39
|
+
<script type="text/javascript">
|
|
40
|
+
|
|
41
|
+
var config = {
|
|
42
|
+
property_id: 'BNVzRZKD',
|
|
43
|
+
customData1: 'some custom data',
|
|
44
|
+
customData2: 'customData2',
|
|
45
|
+
experimentName: 'bitmovinanalytics-local',
|
|
46
|
+
videoId: 'Sintel',
|
|
47
|
+
userId: 'customer#1'
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var analytics = gumlet.insights(config);
|
|
51
|
+
|
|
52
|
+
var video = document.getElementById('my-video');
|
|
53
|
+
|
|
54
|
+
analytics.registerHTML5Player(video);
|
|
55
|
+
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
</body>
|
|
59
|
+
</html>
|