refs #769 Switch public streaming method

This commit is contained in:
AkiraFukushima 2018-12-18 23:17:56 +09:00
parent 1e50e2dd6d
commit 1d30a5e32c
2 changed files with 9 additions and 5 deletions

View File

@ -507,20 +507,21 @@ ipcMain.on('stop-local-streaming', (event, _) => {
let publicStreaming = null
ipcMain.on('start-public-streaming', (event, ac) => {
accountManager.getAccount(ac._id)
ipcMain.on('start-public-streaming', (event, obj) => {
const { account, useWebsocket } = obj
accountManager.getAccount(account._id)
.catch((err) => {
log.error(err)
event.sender.send('error-start-public-streaming', err)
})
.then((account) => {
.then((acct) => {
// Stop old public streaming
if (publicStreaming !== null) {
publicStreaming.stop()
publicStreaming = null
}
publicStreaming = new StreamingManager(account)
publicStreaming = new StreamingManager(acct, useWebsocket)
publicStreaming.start(
'public',
'',

View File

@ -296,7 +296,10 @@ const TimelineSpace = {
},
startPublicStreaming ({ state }) {
return new Promise((resolve, reject) => {
ipcRenderer.send('start-public-streaming', state.account)
ipcRenderer.send('start-public-streaming', {
account: state.account,
useWebsocket: state.useWebsocket
})
ipcRenderer.once('error-start-public-streaming', (event, err) => {
reject(err)
})