完成新页面开发

This commit is contained in:
2026-05-25 21:57:58 +08:00
parent 40fd7f7e08
commit ad93ef342b
5 changed files with 499 additions and 30 deletions

View File

@@ -164,9 +164,14 @@ class CallStateManager {
}
async uploadRecording({ blob, filename }) {
const formData = new FormData();
const people = this.buildRecordingPeopleMetadata();
formData.append('meetingId', this.connectionId || this.state.session.id || 'unknown');
formData.append('userId', this.state.session.localUser.id || '');
formData.append('filename', filename);
if (people.host) {
formData.append('host', JSON.stringify(people.host));
}
formData.append('participants', JSON.stringify(people.participants));
formData.append('recording', blob, filename);
const response = await fetch('/api/recordings', {
@@ -181,6 +186,46 @@ class CallStateManager {
return responseBody;
}
buildRecordingPeopleMetadata() {
const localUser = this.state.session.localUser || {};
const remoteUser = this.state.session.remoteUser || {};
const members = Object.entries(this.state.participants || {}).map(([participantId, participant]) => (
this._buildRecordingPerson(participant, participant.role || 'participant', participantId)
));
const remoteHost = members.find(member => member.role === 'host');
const localPerson = this._buildRecordingPerson(
localUser,
this.role === 'host' || localUser.isHost ? 'host' : 'participant',
this.selfParticipantId || (this.role === 'host' ? 'host' : 'local')
);
if (localPerson.role === 'host') {
return {
host: localPerson,
participants: members.filter(member => member.role !== 'host')
};
}
return {
host: remoteHost || this._buildRecordingPerson(remoteUser, 'host', 'host'),
participants: [
localPerson,
...members.filter(member => member.role !== 'host' && member.participantId !== localPerson.participantId)
]
};
}
_buildRecordingPerson(user = {}, role = 'participant', participantId = '') {
return {
participantId,
userId: user.id || user.userId || '',
id: user.id || user.userId || '',
name: user.name || '',
avatar: user.avatar || '',
role,
status: user.status || '',
mediaState: user.mediaState ? { ...user.mediaState } : undefined
};
}
async _updateLocalMediaRefactored(mediaType, value) {
if (mediaType === 'video' && value) {
await this._enableLocalVideo();