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 let publicStreaming = null
ipcMain.on('start-public-streaming', (event, ac) => { ipcMain.on('start-public-streaming', (event, obj) => {
accountManager.getAccount(ac._id) const { account, useWebsocket } = obj
accountManager.getAccount(account._id)
.catch((err) => { .catch((err) => {
log.error(err) log.error(err)
event.sender.send('error-start-public-streaming', err) event.sender.send('error-start-public-streaming', err)
}) })
.then((account) => { .then((acct) => {
// Stop old public streaming // Stop old public streaming
if (publicStreaming !== null) { if (publicStreaming !== null) {
publicStreaming.stop() publicStreaming.stop()
publicStreaming = null publicStreaming = null
} }
publicStreaming = new StreamingManager(account) publicStreaming = new StreamingManager(acct, useWebsocket)
publicStreaming.start( publicStreaming.start(
'public', 'public',
'', '',

View File

@ -296,7 +296,10 @@ const TimelineSpace = {
}, },
startPublicStreaming ({ state }) { startPublicStreaming ({ state }) {
return new Promise((resolve, reject) => { 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) => { ipcRenderer.once('error-start-public-streaming', (event, err) => {
reject(err) reject(err)
}) })