Updated TypeScript to 3.0.3 and some restructuring
parent
5982f477fc
commit
d280ae7679
|
@ -5,7 +5,7 @@ Welcome here! This repository is created with two reasons:
|
|||
2. People can see TeaSpeak Web client progress and avoid creating repetitive issues all the time.
|
||||
|
||||
#Requirements
|
||||
1. TypeScript Version 2.8.3
|
||||
1. TypeScript Version 3.0.3
|
||||
|
||||
#
|
||||
To **report an issue**, then find and push the **New Issue** button, fill all the fields you see in a template, and then click the **Submit new issue** button.
|
||||
|
|
|
@ -92,6 +92,12 @@ class Settings extends StaticSettings {
|
|||
}, 5 * 1000);
|
||||
}
|
||||
|
||||
static_global?<T>(key: string, _default?: T) : T {
|
||||
let _static = this.static<string>(key);
|
||||
if(_static) StaticSettings.transformStO(_static, _default);
|
||||
return this.global<T>(key, _default);
|
||||
}
|
||||
|
||||
global?<T>(key: string, _default?: T) : T {
|
||||
let result = this.cacheGlobal[key];
|
||||
return StaticSettings.transformStO(result, _default);
|
||||
|
|
|
@ -152,7 +152,7 @@ class ControlBar {
|
|||
if(!targetChannel) targetChannel = this.handle.getClient().currentChannel();
|
||||
let client = this.handle.getClient();
|
||||
|
||||
this.codec_supported = this.handle.voiceConnection.codecSupported(targetChannel.properties.channel_codec);
|
||||
this.codec_supported = targetChannel ? this.handle.voiceConnection.codecSupported(targetChannel.properties.channel_codec) : true;
|
||||
this.support_record = this.handle.voiceConnection.voice_send_support();
|
||||
this.support_playback = this.handle.voiceConnection.voice_playback_support();
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Modals {
|
|||
tag.find(".identity_file").change(function (this: HTMLInputElement) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function() {
|
||||
connectIdentity = TSIdentityHelper.loadIdentityFromFileContains(reader.result);
|
||||
connectIdentity = TSIdentityHelper.loadIdentityFromFileContains(reader.result as string);
|
||||
|
||||
console.log(connectIdentity.uid());
|
||||
if(!connectIdentity) tag.find(".error_message").text("Could not read identity! " + TSIdentityHelper.last_error());
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Modals {
|
|||
applyStandardListener(properties, modal.htmlTag.find(".settings_standard"), modal.htmlTag.find(".button_ok"), parent, !channel);
|
||||
applyPermissionListener(properties, modal.htmlTag.find(".settings_permissions"), modal.htmlTag.find(".button_ok"), permissions, channel);
|
||||
applyAudioListener(properties, modal.htmlTag.find(".settings_audio"), modal.htmlTag.find(".button_ok"), channel);
|
||||
applyAdvancedListener(properties, modal.htmlTag.find(".settings_advanced"), channel);
|
||||
applyAdvancedListener(properties, modal.htmlTag.find(".settings_advanced"), modal.htmlTag.find(".button_ok"), channel);
|
||||
|
||||
let updated: PermissionValue[] = [];
|
||||
modal.htmlTag.find(".button_ok").click(() => {
|
||||
|
|
|
@ -6,6 +6,11 @@ enum PlayerState {
|
|||
STOPPED
|
||||
}
|
||||
|
||||
interface Navigator {
|
||||
mozGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
|
||||
webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
|
||||
}
|
||||
|
||||
class AudioController {
|
||||
private static getUserMediaFunction() {
|
||||
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
/// <reference path="../codec/Codec.ts" />
|
||||
/// <reference path="VoiceRecorder.ts" />
|
||||
|
||||
import WarningListener = NodeJS.WarningListener;
|
||||
|
||||
class CodecPoolEntry {
|
||||
instance: BasicCodec;
|
||||
owner: number;
|
||||
|
@ -106,13 +108,23 @@ enum VoiceConnectionType {
|
|||
NATIVE_ENCODE
|
||||
}
|
||||
|
||||
/* funny fact that typescript dosn't find this */
|
||||
interface RTCPeerConnection {
|
||||
addStream(stream: MediaStream): void;
|
||||
getLocalStreams(): MediaStream[];
|
||||
getStreamById(streamId: string): MediaStream | null;
|
||||
removeStream(stream: MediaStream): void;
|
||||
createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): Promise<RTCSessionDescription>;
|
||||
}
|
||||
|
||||
|
||||
class VoiceConnection {
|
||||
client: TSClient;
|
||||
rtcPeerConnection: RTCPeerConnection;
|
||||
dataChannel: RTCDataChannel;
|
||||
|
||||
voiceRecorder: VoiceRecorder;
|
||||
type: VoiceConnectionType = VoiceConnectionType.NATIVE_ENCODE;
|
||||
type: VoiceConnectionType = VoiceConnectionType.JS_ENCODE;
|
||||
|
||||
local_audio_stream: any;
|
||||
|
||||
|
@ -131,7 +143,7 @@ class VoiceConnection {
|
|||
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
this.type = settings.global("voice_connection_type", VoiceConnectionType.JS_ENCODE);
|
||||
this.type = settings.static_global("voice_connection_type", this.type);
|
||||
this.voiceRecorder = new VoiceRecorder(this);
|
||||
if(this.type != VoiceConnectionType.NATIVE_ENCODE) {
|
||||
this.voiceRecorder.on_data = this.handleVoiceData.bind(this);
|
||||
|
@ -220,8 +232,8 @@ class VoiceConnection {
|
|||
this.dataChannel.binaryType = "arraybuffer";
|
||||
|
||||
let sdpConstraints : RTCOfferOptions = {};
|
||||
sdpConstraints.offerToReceiveAudio = this.type == VoiceConnectionType.NATIVE_ENCODE ? 1 : 0;
|
||||
sdpConstraints.offerToReceiveVideo = 0;
|
||||
sdpConstraints.offerToReceiveAudio = this.type == VoiceConnectionType.NATIVE_ENCODE ? true : false;
|
||||
sdpConstraints.offerToReceiveVideo = false;
|
||||
|
||||
this.rtcPeerConnection.onicecandidate = this.onIceCandidate.bind(this);
|
||||
|
||||
|
|
12
package.json
12
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "client",
|
||||
"version": "1.0.0",
|
||||
"description": "Welcome here! This repository is created with two reasons:\r 1. People can bring their own ideas and follow their implementation\r 2. People can see TeaSpeak Web client progress and avoid creating repetitive issues all the time.",
|
||||
"description": "Welcome here! This repository is created with two reasons:\n 1. People can bring their own ideas and follow their implementation\n 2. People can see TeaSpeak Web client progress and avoid creating repetitive issues all the time.",
|
||||
"main": "main.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
|
@ -12,21 +12,19 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/node": "^9.4.6",
|
||||
"@types/webrtc": "0.0.23"
|
||||
"@types/node": "^9.4.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/emscripten": "0.0.31",
|
||||
"@types/jquery": "^3.3.0",
|
||||
"@types/text-encoding": "0.0.32",
|
||||
"@types/websocket": "0.0.38"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/MypowerHD/TeaWeb.git"
|
||||
"url": "git+https://github.com/TeaSpeak/TeaWeb/TeaWeb.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/MypowerHD/TeaWeb/issues"
|
||||
"url": "https://github.com/TeaSpeak/TeaWeb/issues"
|
||||
},
|
||||
"homepage": "https://github.com/MypowerHD/TeaWeb#readme"
|
||||
"homepage": "https://github.com/TeaSpeak/TeaWeb/TeaWeb#readme"
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "none",
|
||||
"target": "es2016",
|
||||
"target": "es6",
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"js/workers"
|
||||
"js/workers",
|
||||
"enviroment",
|
||||
"tsconfig"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
declare namespace app {
|
||||
let loadedListener: (() => any)[]
|
||||
}
|
||||
declare function displayCriticalError(message: string, closeable: boolean);
|
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "none",
|
||||
"target": "es2016",
|
||||
"sourceMap": true
|
||||
"target": "es6",
|
||||
"sourceMap": true,
|
||||
"typeRoots" : ["../node_modules/@types/"]
|
||||
},
|
||||
"exclude": [
|
||||
"../node_modules",
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
"extends": "./tsconfig_base.json",
|
||||
"compilerOptions": {
|
||||
"outFile": "../generated/js/client.js"
|
||||
"outFile": "../generated/js/client.js",
|
||||
/* because were excluding load.ts we have to define its types */
|
||||
"typeRoots" : ["./@types/", "../node_modules/@types/"]
|
||||
},
|
||||
"exclude": [
|
||||
"../js/load.ts",
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 5fe4c1d9dedf52484b036575d4b068cde8858fb6
|
||||
Subproject commit fafda400bc654848531f8aa163b6cac7cc7abebe
|
Loading…
Reference in New Issue