Remove dependency,

master
Håvar Aambø Fosstveit 2019-11-05 09:46:12 +01:00
parent 51e4d6664d
commit 6d558be11c
2 changed files with 21 additions and 32 deletions

View File

@ -9,7 +9,6 @@
"@material-ui/core": "^4.5.1",
"@material-ui/icons": "^4.5.1",
"bowser": "^2.7.0",
"create-torrent": "^4.4.1",
"domready": "^1.0.8",
"file-saver": "^2.0.2",
"hark": "^1.2.3",

View File

@ -13,8 +13,6 @@ import * as stateActions from './actions/stateActions';
let WebTorrent;
let createTorrent;
let saveAs;
let mediasoupClient;
@ -586,17 +584,8 @@ export default class RoomClient
text : 'Starting file share.'
}));
createTorrent(files, (err, torrent) =>
this._webTorrent.seed(files, (torrent) =>
{
if (err)
{
return store.dispatch(requestActions.notify(
{
type : 'error',
text : 'Unable to upload file.'
}));
}
const existingTorrent = this._webTorrent.get(torrent);
if (existingTorrent)
@ -604,8 +593,6 @@ export default class RoomClient
return this._sendFile(existingTorrent.magnetURI);
}
this._webTorrent.seed(files, (newTorrent) =>
{
store.dispatch(requestActions.notify(
{
text : 'File successfully shared.'
@ -613,11 +600,10 @@ export default class RoomClient
store.dispatch(stateActions.addFile(
this._peerId,
newTorrent.magnetURI
torrent.magnetURI
));
this._sendFile(newTorrent.magnetURI);
});
this._sendFile(torrent.magnetURI);
});
}
@ -1162,13 +1148,6 @@ export default class RoomClient
'webtorrent'
));
({ default: createTorrent } = await import(
/* webpackPrefetch: true */
/* webpackChunkName: "create-torrent" */
'create-torrent'
));
({ default: saveAs } = await import(
/* webpackPrefetch: true */
@ -1219,6 +1198,17 @@ export default class RoomClient
}
});
this._webTorrent.on('error', (error) =>
{
logger.error('Filesharing [error:"%o"]', error);
store.dispatch(requestActions.notify(
{
type : 'error',
text : `An error occured with file sharing`
}));
});
this._screenSharing = ScreenShare.create(this._device);
this._signalingSocket = io(this._signalingUrl);