Skip to content

Commit 97acb90

Browse files
committed
fix: fix app-plyr useCustomControls when room.isWriteable:false can't sync
1 parent 6f2230c commit 97acb90

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

packages/app-plyr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netless/app-plyr",
3-
"version": "0.2.6",
3+
"version": "0.2.7",
44
"description": "Netless App Media Player, based on plyr.io.",
55
"repository": "netless-io/netless-app",
66
"license": "MIT",

packages/app-plyr/src/controller.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,9 @@ export class CustomPlyrControls {
949949
}
950950

951951
private syncPlay = () => {
952+
if (!this.controller.context.getIsWritable()) {
953+
return;
954+
}
952955
if (this.PlayButton.classList.contains("playing")) {
953956
this.controller.pause();
954957
} else {
@@ -970,10 +973,16 @@ export class CustomPlyrControls {
970973
* @param seekTime 播放进度, 单位秒
971974
*/
972975
private syncSeek = (seekTime: number) => {
976+
if (!this.controller.context.getIsWritable()) {
977+
return;
978+
}
973979
this.controller.seekTime(seekTime);
974980
};
975981

976982
private eventSeek = (e: PointerEvent) => {
983+
if (!this.controller.context.getIsWritable()) {
984+
return;
985+
}
977986
const offsetX = e.offsetX;
978987
const width = this.ProgressSliderContainer.offsetWidth;
979988
const progress = offsetX / width;
@@ -997,6 +1006,9 @@ export class CustomPlyrControls {
9971006
if (e.cancelable) {
9981007
e.preventDefault();
9991008
}
1009+
if (!this.controller.context.getIsWritable()) {
1010+
return;
1011+
}
10001012
this._isDraggingProgress = true;
10011013
const offsetX = e.offsetX + this.ProgressSliderButton.offsetLeft;
10021014
this.dragStartX = [e.clientX, offsetX];
@@ -1009,6 +1021,9 @@ export class CustomPlyrControls {
10091021
if (e.cancelable) {
10101022
e.preventDefault();
10111023
}
1024+
if (!this.controller.context.getIsWritable()) {
1025+
return;
1026+
}
10121027
if (!this.dragStartX) {
10131028
return;
10141029
}
@@ -1029,6 +1044,9 @@ export class CustomPlyrControls {
10291044
if (e.cancelable) {
10301045
e.preventDefault();
10311046
}
1047+
if (!this.controller.context.getIsWritable()) {
1048+
return;
1049+
}
10321050
if (!this.dragStartX) {
10331051
return;
10341052
}

0 commit comments

Comments
 (0)