Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit b80c458

Browse files
committed
Support sending MediaStream over WebTransport streams.
1 parent 1c17822 commit b80c458

File tree

12 files changed

+304
-291
lines changed

12 files changed

+304
-291
lines changed

docs/mdfiles/changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Change Log
66
* Add a new property `rtpTransceivers` to `TransportSettings` and `TransportConstraints`.
77
* Add a new property `peerConnection` to `ConferenceClient`.
88
* The second argument of `ConferenceClient.publish` could be a list of `RTCRtpTransceiver`s.
9+
* Add support to publish a MediaStream over WebTransport.
10+
911
# 5.0
1012
* Add WebTransport support for conference mode, see [this design doc](../../design/webtransport.md) for detailed information.
1113
* All publications and subscriptions for the same conference use the same `PeerConnection`.

docs/mdfiles/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ WebTransport is supported in conference mode as an experimental feature. QUIC ag
142142
- [JavaScript SDK design doc for WebTransport support](https://github.com/open-webrtc-toolkit/owt-client-javascript/blob/master/docs/design/webtransport.md)
143143
- [QUIC programming guide for OWT server](https://github.com/open-webrtc-toolkit/owt-server/blob/master/doc/design/quic-programming-guide.md)
144144

145+
Publishing a MediaStream over WebTransport requires an additional worker for I/O. The worker is a standalone ES module, not included in owt.js. As we're moving the SDK from traditional JavaScript script to ES module, there is no plan to support this worker in old browsers.
146+
145147
# 7 Events
146148

147149
The JavaScript objects fires events using `Owt.Base.EventDispatchers`. For more detailed events, please refer to the specific class description page.

scripts/Gruntfile.js

+17-4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ window.L = L;\n\
7676
watch: true
7777
},
7878
},
79+
worker:{
80+
src: ['dist/sdk/conference/webtransport/media-worker.js'],
81+
dest: 'dist/sdk/media-worker.js',
82+
},
7983
sinon: {
8084
src: ['node_modules/sinon/lib/sinon.js'],
8185
dest: 'test/unit/resources/scripts/gen/sinon-browserified.js',
@@ -102,7 +106,15 @@ window.L = L;\n\
102106
options: {
103107
base: '.',
104108
port: 7080,
105-
keepalive: true
109+
keepalive: true,
110+
middleware: function(connect, options, middlewares) {
111+
middlewares.unshift((req, res, next) => {
112+
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
113+
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
114+
next();
115+
});
116+
return middlewares;
117+
}
106118
},
107119
},
108120
},
@@ -189,7 +201,8 @@ window.L = L;\n\
189201
{expand: true,cwd:'src/extension/',src:['**'],dest:'dist/',flatten:false},
190202
{expand: true,cwd:'dist/sdk/',src:['owt.js'],dest:'dist/samples/conference/public/scripts/',flatten:false},
191203
{expand: true,cwd:'dist/samples/conference/public/scripts',src:['rest.js'],dest:'dist/samples/conference/',flatten:false},
192-
{expand: true,cwd:'dist/sdk/',src:['owt.js'],dest:'dist/samples/p2p/js/',flatten:false}
204+
{expand: true,cwd:'dist/sdk/',src:['owt.js'],dest:'dist/samples/p2p/js/',flatten:false},
205+
{expand: true,cwd: 'dist/sdk/',src: ['media-worker.js'],dest: 'dist/samples/conference/public/scripts/',flatten: false},
193206
]
194207
}
195208
},
@@ -267,8 +280,8 @@ window.L = L;\n\
267280

268281
grunt.registerTask('check', ['eslint:src']);
269282
grunt.registerTask('prepare', ['browserify:sinon', 'browserify:chai_as_promised']);
270-
grunt.registerTask('pack', ['browserify:dist', 'concat:rest', 'uglify:dist', 'copy:dist', 'string-replace', 'compress:dist', 'jsdoc:dist']);
271-
grunt.registerTask('dev', ['browserify:dev', 'connect:server']);
283+
grunt.registerTask('pack', ['browserify:dist', 'browserify:worker', 'concat:rest', 'uglify:dist', 'copy:dist', 'string-replace', 'compress:dist', 'jsdoc:dist']);
284+
grunt.registerTask('dev', ['browserify:dev', 'browserify:worker', 'connect:server']);
272285
grunt.registerTask('debug', ['browserify:dev']);
273286
grunt.registerTask('default', ['check', 'pack']);
274287
};

src/samples/conference/public/quic.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323

2424
<body>
2525
<h1>Open WebRTC Toolkit</h1>
26-
<h2>Sample of QuicTransport</h2>
26+
<h2>Sample of WebTransport</h2>
2727
<div id="description">
28-
<p>This sample works with the latest Chrome.</p>
28+
<p>This sample works with the Chrome >= 97.</p>
2929
</div>
3030
<div class="operations">
3131
<button id="start-sending">Start sending</button>

src/samples/conference/public/scripts/media-worker.js

-158
This file was deleted.

0 commit comments

Comments
 (0)