feat(player): support new msg struct in assist player
This commit is contained in:
parent
48af7b93b9
commit
61f212b5f1
5 changed files with 20 additions and 7 deletions
|
|
@ -24,9 +24,12 @@ function Controls(props: any) {
|
|||
const { jumpToLive } = player;
|
||||
const {
|
||||
livePlay,
|
||||
logMarkedCountNow: logRedCount,
|
||||
exceptionsList,
|
||||
currentTab,
|
||||
tabStates
|
||||
} = store.get();
|
||||
|
||||
const exceptionsList = tabStates[currentTab]?.exceptionsList || [];
|
||||
const logRedCount = tabStates[currentTab]?.logMarkedCountNow || 0;
|
||||
const showExceptions = exceptionsList.length > 0;
|
||||
const {
|
||||
bottomBlock,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ function Controls(props: any) {
|
|||
} = store.get();
|
||||
|
||||
const cssLoading = tabStates[currentTab]?.cssLoading ?? false;
|
||||
const exceptionsList = tabStates[currentTab]?.exceptionsList || [];
|
||||
const profilesList = tabStates[currentTab]?.profilesList || [];
|
||||
const graphqlList = tabStates[currentTab]?.graphqlList || [];
|
||||
const logRedCount = tabStates[currentTab]?.logMarkedCountNow || 0;
|
||||
|
|
|
|||
|
|
@ -174,11 +174,12 @@ export default class MessageManager {
|
|||
this.state.update({ currentTab: tabId })
|
||||
this.activeTab = tabId
|
||||
}
|
||||
if (!this.tabs[this.activeTab]) {
|
||||
|
||||
if (this.tabs[this.activeTab]) {
|
||||
this.tabs[this.activeTab].move(t)
|
||||
} else {
|
||||
console.error('missing tab state', this.tabs, this.activeTab, tabId, this.activeTabManager.list)
|
||||
}
|
||||
// console.log(this.tabs, this.activeTab)
|
||||
this.tabs[this.activeTab].move(t)
|
||||
})
|
||||
|
||||
if (this.waitingForFiles && this.lastMessageTime <= t && t !== this.session.duration.milliseconds) {
|
||||
|
|
|
|||
|
|
@ -166,15 +166,18 @@ export default class AssistManager {
|
|||
waitingForMessages = true
|
||||
this.setStatus(ConnectionStatus.WaitingMessages) // TODO: reconnect happens frequently on bad network
|
||||
})
|
||||
|
||||
let currentTab = ''
|
||||
socket.on('messages', messages => {
|
||||
jmr.append(messages) // as RawMessage[]
|
||||
|
||||
console.log(messages)
|
||||
if (waitingForMessages) {
|
||||
waitingForMessages = false // TODO: more explicit
|
||||
this.setStatus(ConnectionStatus.Connected)
|
||||
}
|
||||
|
||||
for (let msg = reader.readNext();msg !== null;msg = reader.readNext()) {
|
||||
console.log(msg)
|
||||
this.handleMessage(msg, msg._index)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ export default class MStreamReader {
|
|||
|
||||
private t: number = 0
|
||||
private idx: number = 0
|
||||
|
||||
currentTab = ''
|
||||
readNext(): Message & { _index: number } | null {
|
||||
let msg = this.r.readMessage()
|
||||
if (msg === null) { return null }
|
||||
|
|
@ -19,10 +21,15 @@ export default class MStreamReader {
|
|||
this.t = msg.timestamp - this.startTs
|
||||
return this.readNext()
|
||||
}
|
||||
if (msg.tp === MType.TabData) {
|
||||
this.currentTab = msg.tabId
|
||||
return this.readNext()
|
||||
}
|
||||
|
||||
return Object.assign(msg, {
|
||||
time: this.t,
|
||||
_index: this.idx++,
|
||||
tabId: this.currentTab,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue