Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from 'react'
import WebTorrent from 'webtorrent/webtorrent.min'
import Auth from '../modules/Auth'
import { formatVideoTime, BytestoSize, uuidv8 } from '../modules/Library'
var torrentID = ''
var playlist = []
// Disable DHT
var client = new WebTorrent({
dht: false
})
// Announces list
// global.WEBTORRENT_ANNOUNCE = [
// 'ws://localhost:6969'
// ]
// Display webtorrent video
var displayVideo = (props) => {
// Show overlay
$('#video-components .fs-overlay').css({ 'visibility': 'visible', 'opacity': '1', 'width': '100vw', 'height': '100vh' })
$('#video-topbar .title').html(props.title)
// Reset loader
$('#video-loader .loader-inner').show()
import WebTorrent from 'webtorrent/webtorrent.min';
const client = new WebTorrent();
client.on('error', err => console.error(err));
const torrents = {};
export const addTorrent = url => {
if (torrents[url]) {
return torrents[url];
}
torrents[url] = client.add(url);
return torrents[url];
};
export default client;
var setPeerId = (peerId) => {
client.destroy()
client = new WebTorrent({
peerId: peerId,
dht: false
})
}
import { UPDATE_INFO } from './constants'
import Webtorrent from 'webtorrent/webtorrent.min'
import rtcConfig from '../../rtcConfig.json'
const initialState = {
client: new Webtorrent({
tracker: {
rtcConfig: rtcConfig
}
})
}
export default function webtorrent (state = initialState, action) {
switch (action.type) {
case UPDATE_INFO:
return state
default:
return state
}
}