| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset=utf-8> |
| 5 <title>Media Recorder IDL test</title> |
| 6 <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder
.html"> |
| 7 <link rel="idl" href="https://w3c.github.io/mediacapture-record/MediaRecorder.
html#idl-index"> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <script src="/resources/WebIDLParser.js"></script> |
| 11 <script src="/resources/idlharness.js"></script> |
| 12 </head> |
| 13 <body> |
| 14 <canvas id='canvas' width=10 height=10/> |
| 15 |
| 16 <pre id="untested_idl" style="display: none"> |
| 17 interface Event {}; |
| 18 interface EventHandler {}; |
| 19 interface EventTarget {}; |
| 20 interface MediaStream {}; |
| 21 </pre> |
| 22 <pre id="idl" style="display: none"> |
| 23 // https://w3c.github.io/mediacapture-record/MediaRecorder.html |
| 24 |
| 25 [Constructor(MediaStream stream, optional MediaRecorderOptions options)] |
| 26 interface MediaRecorder : EventTarget { |
| 27 readonly attribute MediaStream stream; |
| 28 readonly attribute DOMString mimeType; |
| 29 readonly attribute RecordingState state; |
| 30 attribute EventHandler onstart; |
| 31 attribute EventHandler onstop; |
| 32 attribute EventHandler ondataavailable; |
| 33 attribute EventHandler onpause; |
| 34 attribute EventHandler onresume; |
| 35 attribute EventHandler onerror; |
| 36 readonly attribute unsigned long videoBitsPerSecond; |
| 37 readonly attribute unsigned long audioBitsPerSecond; |
| 38 |
| 39 void start(optional long timeslice); |
| 40 void stop(); |
| 41 void pause(); |
| 42 void resume(); |
| 43 void requestData(); |
| 44 |
| 45 static boolean isTypeSupported(DOMString type); |
| 46 }; |
| 47 |
| 48 dictionary MediaRecorderOptions { |
| 49 DOMString mimeType; |
| 50 unsigned long audioBitsPerSecond; |
| 51 unsigned long videoBitsPerSecond; |
| 52 unsigned long bitsPerSecond; |
| 53 }; |
| 54 |
| 55 enum RecordingState { |
| 56 "inactive", |
| 57 "recording", |
| 58 "paused" |
| 59 }; |
| 60 |
| 61 [Constructor(DOMString type, BlobEventInit eventInitDict)] |
| 62 interface BlobEvent : Event { |
| 63 [SameObject] readonly attribute Blob data; |
| 64 readonly attribute DOMHighResTimeStamp timecode; |
| 65 }; |
| 66 |
| 67 dictionary BlobEventInit { |
| 68 required Blob data; |
| 69 DOMHighResTimeStamp timecode; |
| 70 }; |
| 71 |
| 72 dictionary MediaRecorderErrorEventInit : EventInit { |
| 73 required DOMException error; |
| 74 }; |
| 75 |
| 76 [Exposed=Window, Constructor(DOMString type, MediaRecorderErrorEventInit eve
ntInitDict)] |
| 77 interface MediaRecorderErrorEvent : Event { |
| 78 [SameObject] readonly attribute DOMException error; |
| 79 }; |
| 80 |
| 81 </pre> |
| 82 <script> |
| 83 var canvas = document.getElementById('canvas'); |
| 84 var context = canvas.getContext("2d"); |
| 85 context.fillStyle = "red"; |
| 86 context.fillRect(0, 0, 10, 10); |
| 87 var stream = canvas.captureStream(); |
| 88 |
| 89 var idl_array = new IdlArray(); |
| 90 idl_array.add_untested_idls(document.getElementById("untested_idl").textCont
ent); |
| 91 idl_array.add_idls(document.getElementById("idl").textContent); |
| 92 idl_array.add_objects({ |
| 93 MediaRecorder: [new MediaRecorder(stream)], |
| 94 }); |
| 95 idl_array.test(); |
| 96 </script> |
| 97 <div id="log"></div> |
| 98 </body> |
| 99 </html> |
| OLD | NEW |