You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 822258b
Browse filesBrowse the repository at this point in the historyBrowse files
A sender's frames are recorded as they leave the encoder, a receiver's as they go to the decoder. Senders and receivers of any number of peer connections can go into one file, e.g. both sides of a call.
32
32
33
-
`stop()` waits until everything received so far is written and the file is finished, and returns whether the file holds a recording. A recorder that never got any media to write deletes its file rather than leave an unplayable one behind. `close()` stops a recording that still runs.
33
+
`stop()` waits until everything received so far is written and the file is finished and closed, and returns whether the file holds a recording. A recorder that never got any media to write deletes its file rather than leave an unplayable one behind. `close()` stops a recording that still runs.
34
+
35
+
How the recording ended, `getResult()` tells once the recorder is stopped, and keeps telling after `close()`:
36
+
37
+
| Result | File | Meaning |
38
+
| --- | --- | --- |
39
+
|`COMPLETE`| kept | Everything was written, and the file was finished and closed. |
40
+
|`PARTIAL`| kept | Media went into the file, but writing, finishing or closing it failed later. What made it into the file is kept, since it may still play. |
41
+
|`EMPTY`| deleted | No media arrived before the stop. |
42
+
|`FAILED`| deleted | Writing failed before any media went into the file. |
43
+
44
+
```java
45
+
recorder.stop();
46
+
47
+
if (recorder.getResult() ==MediaRecorderResult.PARTIAL) {
48
+
System.out.println("Incomplete recording in "+ recorder.getFile());
49
+
}
50
+
```
34
51
35
52
::: warning
36
53
Keep the senders and receivers undisposed while recording. The recorder asks them for key frames, and a disposed one cannot be asked.
Calls arrive in order on a thread the recorder keeps for them, so a listener may take its time and may even stop the recorder.
87
104
105
+
`onError` also hears of a file that cannot be finished or closed when the recorder stops, e.g. because the last data does not fit on the disk. The recording then ends as `PARTIAL`.
106
+
88
107
## How Tracks Are Recorded
89
108
90
109
-**Video starts at a key frame.** A decoder can do nothing with the frames before one, so they are skipped. The recorder asks the sender or receiver for a key frame, so recording starts within moments instead of waiting until WebRTC sends one of its own accord, which it rarely does.
0 commit comments