Skip to content

Commit

Permalink
feat: webrtc audio support
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiren233 committed Dec 17, 2024
1 parent fdec3cf commit 76775b6
Show file tree
Hide file tree
Showing 5 changed files with 321 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/hooks/useRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ export const useRoomPermission = () => {
[RoomMemberPermission.PermissionEditMovie]: "编辑影片",
[RoomMemberPermission.PermissionSetCurrentMovie]: "老板换碟",
[RoomMemberPermission.PermissionSetCurrentStatus]: "同步视频进度",
[RoomMemberPermission.PermissionSendChatMessage]: "聊天和弹幕"
[RoomMemberPermission.PermissionSendChatMessage]: "聊天和弹幕",
[RoomMemberPermission.PermissionWebRTC]: "加入语音"
};

const roomMemberPermissionKeys = Object.keys(RoomMemberPermission)
Expand Down
12 changes: 12 additions & 0 deletions src/proto/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ enum MessageType {
VIEWER_COUNT = 8;
SYNC = 9;
MY_STATUS = 10;
WEBRTC_OFFER = 11;
WEBRTC_ANSWER = 12;
WEBRTC_ICE_CANDIDATE = 13;
WEBRTC_JOIN = 14;
WEBRTC_LEAVE = 15;
}

message Sender {
Expand All @@ -28,6 +33,12 @@ message Status {
double playback_rate = 3;
}

message WebRTCData {
string data = 1;
string to = 2;
string from = 3;
}

message Message {
MessageType type = 1;
sfixed64 timestamp = 2;
Expand All @@ -39,5 +50,6 @@ message Message {
Status playback_status = 6;
fixed64 expiration_id = 7;
int64 viewer_count = 8;
WebRTCData webrtc_data = 9;
}
}
150 changes: 149 additions & 1 deletion src/proto/message.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/types/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export enum RoomMemberPermission {
PermissionSetCurrentMovie = 1 << 4,
PermissionSetCurrentStatus = 1 << 5,
PermissionSendChatMessage = 1 << 6,
PermissionWebRTC = 1 << 7,

// AllPermissions = (2 ^ 32) - 1,
NoPermission = 0
Expand Down
Loading

0 comments on commit 76775b6

Please sign in to comment.