export function getColorByString(str: string) : string|null { let hash = 0; if (str.length === 0) { return null; } for (let i = 0; i < str.length; i++) { hash = str.charCodeAt(i) + ((hash << 5) - hash); hash = hash & hash; } let color = '#'; for (let i = 0; i < 3; i++) { const value = (hash >> (i * 8)) & 255; color += ('00' + value.toString(16)).substr(-2); } return color; } export function srcObject(node: HTMLVideoElement, stream: MediaStream) { node.srcObject = stream; return { update(newStream: MediaStream) { if (node.srcObject != newStream) { node.srcObject = newStream } } } }