RTCRtpSender-getCapabilities.html (1697B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>RTCRtpSender.getCapabilities</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="dictionary-helper.js"></script> 7 <script src="RTCRtpCapabilities-helper.js"></script> 8 <script> 9 'use strict'; 10 11 // Test is based on the following editor draft: 12 // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html 13 14 // The following helper functions are called from RTCRtpCapabilities-helper.js: 15 // validateRtpCapabilities 16 17 /* 18 5.2. RTCRtpSender Interface 19 interface RTCRtpSender { 20 ... 21 static RTCRtpCapabilities getCapabilities(DOMString kind); 22 }; 23 24 getCapabilities 25 The getCapabilities() method returns the most optimist view on the capabilities 26 of the system for sending media of the given kind. It does not reserve any 27 resources, ports, or other state but is meant to provide a way to discover 28 the types of capabilities of the browser including which codecs may be supported. 29 */ 30 test(() => { 31 const capabilities = RTCRtpSender.getCapabilities('audio'); 32 validateRtpCapabilities(capabilities); 33 }, `RTCRtpSender.getCapabilities('audio') should return RTCRtpCapabilities dictionary`); 34 35 test(() => { 36 const capabilities = RTCRtpSender.getCapabilities('video'); 37 validateRtpCapabilities(capabilities); 38 }, `RTCRtpSender.getCapabilities('video') should return RTCRtpCapabilities dictionary`); 39 40 test(() => { 41 const capabilities = RTCRtpSender.getCapabilities('dummy'); 42 assert_equals(capabilities, null); 43 }, `RTCRtpSender.getCapabilities('dummy') should return null`); 44 45 </script>