Skip to content

Commit 7c3df3b

Browse files
authored
feat(UI): Allow forceDisconnect when destroy the UI (#8472)
1 parent 9d3b586 commit 7c3df3b

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lib/cast/cast_proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
106106
* @override
107107
* @export
108108
*/
109-
destroy(forceDisconnect) {
109+
destroy(forceDisconnect = false) {
110110
if (this.sender_ && forceDisconnect) {
111111
this.sender_.forceDisconnect();
112112
}

ui/controls.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,12 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
222222
}
223223

224224
/**
225+
* @param {boolean=} forceDisconnect If true, force the receiver app to shut
226+
* down by disconnecting. Does nothing if not connected.
225227
* @override
226228
* @export
227229
*/
228-
async destroy() {
230+
async destroy(forceDisconnect = false) {
229231
if (document.pictureInPictureElement == this.localVideo_) {
230232
await document.exitPictureInPicture();
231233
}
@@ -271,7 +273,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
271273
}
272274

273275
if (this.castProxy_) {
274-
await this.castProxy_.destroy();
276+
await this.castProxy_.destroy(forceDisconnect);
275277
this.castProxy_ = null;
276278
}
277279

ui/ui.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,14 @@ shaka.ui.Overlay = class {
101101

102102

103103
/**
104+
* @param {boolean=} forceDisconnect If true, force the receiver app to shut
105+
* down by disconnecting. Does nothing if not connected.
104106
* @override
105107
* @export
106108
*/
107-
async destroy() {
109+
async destroy(forceDisconnect = false) {
108110
if (this.controls_) {
109-
await this.controls_.destroy();
111+
await this.controls_.destroy(forceDisconnect);
110112
}
111113
this.controls_ = null;
112114

0 commit comments

Comments
 (0)