├── .editorconfig
├── .github
└── workflows
│ └── ci.yml
├── .gitignore
├── .npmignore
├── .nvmrc
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── index.html
├── package-lock.json
├── package.json
├── scripts
├── karma.conf.js
├── postcss.config.js
└── rollup.config.js
├── src
├── components
│ ├── ResolutionMenuButton.js
│ └── ResolutionMenuItem.js
├── const
│ ├── CALLBACKS.js
│ └── COMMANDS.js
├── plugin.js
└── plugin.scss
└── test
└── plugin.test.js
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | end_of_line = lf
7 | indent_style = space
8 | indent_size = 2
9 | insert_final_newline = true
10 | trim_trailing_whitespace = true
11 |
12 | [*.md]
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: ci
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | should-skip:
7 | continue-on-error: true
8 | runs-on: ubuntu-22.04
9 | # Map a step output to a job output
10 | outputs:
11 | should-skip-job: ${{steps.skip-check.outputs.should_skip}}
12 | steps:
13 | - id: skip-check
14 | uses: fkirc/skip-duplicate-actions@v2.1.0
15 | with:
16 | github_token: ${{github.token}}
17 |
18 | ci:
19 | needs: should-skip
20 | if: ${{needs.should-skip.outputs.should-skip-job != 'true' || github.ref == 'refs/heads/main'}}
21 | strategy:
22 | fail-fast: false
23 | matrix:
24 | os: [ubuntu-22.04]
25 | test-type: ['unit']
26 | env:
27 | BROWSER_STACK_USERNAME: ${{secrets.BROWSER_STACK_USERNAME}}
28 | BROWSER_STACK_ACCESS_KEY: ${{secrets.BROWSER_STACK_ACCESS_KEY}}
29 | CI_TEST_TYPE: ${{matrix.test-type}}
30 | runs-on: ${{matrix.os}}
31 | steps:
32 | - name: checkout code
33 | uses: actions/checkout@v2
34 |
35 | - name: read node version from .nvmrc
36 | run: echo ::set-output name=NVMRC::$(cat .nvmrc)
37 | shell: bash
38 | id: nvm
39 |
40 | - name: update apt cache on linux w/o browserstack
41 | run: sudo apt-get update
42 |
43 | - name: install ffmpeg/pulseaudio for firefox on linux w/o browserstack
44 | run: sudo apt-get install ffmpeg pulseaudio
45 |
46 | - name: start pulseaudio for firefox on linux w/o browserstack
47 | run: pulseaudio -D
48 |
49 | - name: setup node
50 | uses: actions/setup-node@v4
51 | with:
52 | node-version: '${{steps.nvm.outputs.NVMRC}}'
53 | cache: npm
54 |
55 | # turn off the default setup-node problem watchers...
56 | - run: echo "::remove-matcher owner=eslint-compact::"
57 | - run: echo "::remove-matcher owner=eslint-stylish::"
58 | - run: echo "::remove-matcher owner=tsc::"
59 |
60 | - name: npm install
61 | run: npm i --prefer-offline --no-audit
62 |
63 | - name: run npm test
64 | uses: GabrielBB/xvfb-action@v1
65 | with:
66 | run: npm run test
67 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS
2 | Thumbs.db
3 | ehthumbs.db
4 | Desktop.ini
5 | .DS_Store
6 | ._*
7 |
8 | # Editors
9 | *~
10 | *.swp
11 | *.tmproj
12 | *.tmproject
13 | *.sublime-*
14 | .idea/
15 | .project/
16 | .settings/
17 | .vscode/
18 |
19 | # Logs
20 | logs
21 | *.log
22 | npm-debug.log*
23 |
24 | # Dependency directories
25 | bower_components/
26 | node_modules/
27 |
28 | # Build-related directories
29 | dist/
30 | es/
31 | cjs/
32 | docs/api/
33 | test/dist/
34 | .eslintcache
35 | .yo-rc.json
36 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | # Intentionally left blank, so that npm does not ignore anything by default,
2 | # but relies on the package.json "files" array to explicitly define what ends
3 | # up in the package.
4 |
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | 14
2 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-media/videojs-webrtc-plugin/e5e94e54f7a17e919920581e0ed92cea1d4474c5/CHANGELOG.md
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # CONTRIBUTING
2 |
3 | We welcome contributions from everyone!
4 |
5 | ## Getting Started
6 |
7 | Make sure you have Node.js 8 or higher and npm installed.
8 |
9 | 1. Fork this repository and clone your fork
10 | 1. Install dependencies: `npm install`
11 | 1. Run a development server: `npm start`
12 |
13 | ### Making Changes
14 |
15 | Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship.
16 |
17 | When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository.
18 |
19 | ### Running Tests
20 |
21 | Testing is a crucial part of any software project. For all but the most trivial changes (typos, etc) test cases are expected. Tests are run in actual browsers using [Karma][karma].
22 |
23 | - In all available and supported browsers: `npm test`
24 | - In a specific browser: `npm run test:chrome`, `npm run test:firefox`, etc.
25 | - While development server is running (`npm start`), navigate to [`http://localhost:9999/test/`][local]
26 |
27 |
28 | [karma]: http://karma-runner.github.io/
29 | [local]: http://localhost:9999/test/
30 | [conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) ForaSoft
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # videojs-webrtc-plugin
2 |
3 | Plugin for viewing streams located on the ant-media server. There is also a function to change the resolution of the stream
4 |
5 | ## Table of Contents
6 |
7 |
8 |
9 |
10 | - [Quick Start](#quick-start)
11 | - [Installation](#installation)
12 | - [Issues](#issues)
13 | - [Usage](#usage)
14 | - [Source Object](#source-object)
15 | - [**streamUrl**](#streamurl)
16 | - [**iceServers**](#iceservers)
17 | - [`
98 |
99 |
100 |
101 |
106 |
107 |
110 | ```
111 |
112 | ### Browserify/CommonJS
113 |
114 | When using with Browserify, install videojs-webrtc-plugin via npm and `require` the plugin as you would any other module.
115 |
116 | ```js
117 | var videojs = require('video.js');
118 |
119 | // The actual plugin function is exported by this module, but it is also
120 | // attached to the `Player.prototype`; so, there is no need to assign it
121 | // to a variable.
122 | require('videojs-webrtc-plugin');
123 |
124 | var player = videojs('my-video');
125 |
126 | player.src({
127 | src: 'ws://localhost:5080/LiveApp/stream1.webrtc',
128 | iceServers: '[ { "urls": "stun:stun1.l.google.com:19302" } ]'
129 | });
130 | ```
131 |
132 | ### RequireJS/AMD
133 |
134 | When using with RequireJS (or another AMD library), get the script in whatever way you prefer and `require` the plugin as you normally would:
135 |
136 | ```js
137 | require(['video.js', 'videojs-webrtc-plugin'], function(videojs) {
138 | var player = videojs('my-video');
139 |
140 | player.src({
141 | src: 'ws://localhost:5080/LiveApp/stream1.webrtc',
142 | iceServers: '[ { "urls": "stun:stun1.l.google.com:19302" } ]'
143 | });
144 | });
145 | ```
146 |
147 | ### Handling error-callbacks
148 |
149 | Ant-MediaServer has functionality to handle errors coming from the backend.
150 | To catch an error, you need to subscribe to the event "ant-error":
151 |
152 | ```js
153 |
154 |
155 |
166 | ```
167 | ## License
168 |
169 | MIT. Copyright (c) Ant Media
170 |
171 | [videojs]: http://videojs.com/
172 |
173 | ## Issues
174 |
175 | In case of any problem, please create issues at [Ant-Media-Server Repository](https://github.com/ant-media/Ant-Media-Server/issues)
176 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | videojs-webrtc-plugin Demo
6 |
7 |
8 |
46 |
47 |
48 |