@flashphoner/websdk 2.0.201 → 2.0.206
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docTemplate/README.md +1 -1
- package/examples/demo/sip/phone/phone.js +7 -10
- package/examples/demo/streaming/hls-player/hls-player.html +1 -4
- package/examples/demo/streaming/hls-player/hls-player.js +19 -1
- package/examples/demo/streaming/hls-player/player-page.html +1 -1
- package/examples/demo/streaming/hls-player/video-js.css +142 -51
- package/examples/demo/streaming/hls-player/video.js +27294 -20390
- package/examples/demo/streaming/hls-player/video.min.js +27 -0
- package/examples/demo/streaming/media_devices_manager/manager.js +27 -1
- package/examples/demo/streaming/media_devices_manager/media_device_manager.html +7 -0
- package/examples/typescript/two-way-streaming-ts/.gitignore +23 -0
- package/examples/typescript/two-way-streaming-ts/README.md +36 -0
- package/examples/typescript/two-way-streaming-ts/package.json +45 -0
- package/examples/typescript/two-way-streaming-ts/public/favicon.ico +0 -0
- package/examples/typescript/two-way-streaming-ts/public/index.html +33 -0
- package/examples/typescript/two-way-streaming-ts/public/logo192.png +0 -0
- package/examples/typescript/two-way-streaming-ts/public/logo512.png +0 -0
- package/examples/typescript/two-way-streaming-ts/public/manifest.json +25 -0
- package/examples/typescript/two-way-streaming-ts/public/media/preloader.mp4 +0 -0
- package/examples/typescript/two-way-streaming-ts/public/robots.txt +3 -0
- package/examples/typescript/two-way-streaming-ts/src/TwoWayStreamingApp.css +23 -0
- package/examples/typescript/two-way-streaming-ts/src/TwoWayStreamingApp.tsx +371 -0
- package/examples/typescript/two-way-streaming-ts/src/fp-utils.ts +117 -0
- package/examples/typescript/two-way-streaming-ts/src/index.css +13 -0
- package/examples/typescript/two-way-streaming-ts/src/index.tsx +9 -0
- package/examples/typescript/two-way-streaming-ts/tsconfig.json +26 -0
- package/examples/vue/two-way-streaming-vue/.gitignore +23 -0
- package/examples/vue/two-way-streaming-vue/README.md +36 -0
- package/examples/vue/two-way-streaming-vue/babel.config.js +5 -0
- package/examples/vue/two-way-streaming-vue/package.json +47 -0
- package/examples/vue/two-way-streaming-vue/public/favicon.ico +0 -0
- package/examples/vue/two-way-streaming-vue/public/index.html +17 -0
- package/examples/vue/two-way-streaming-vue/src/TwoWayStreamingApp.vue +346 -0
- package/examples/vue/two-way-streaming-vue/src/assets/media/preloader.mp4 +0 -0
- package/examples/vue/two-way-streaming-vue/src/fp-utils.js +117 -0
- package/examples/vue/two-way-streaming-vue/src/main.js +9 -0
- package/examples/vue/two-way-streaming-vue/vue.config.js +8 -0
- package/flashphoner-no-flash.js +4 -4
- package/flashphoner-no-flash.min.js +1 -1
- package/flashphoner-no-webrtc.js +4 -4
- package/flashphoner-no-webrtc.min.js +1 -1
- package/flashphoner-no-wsplayer.js +4 -4
- package/flashphoner-no-wsplayer.min.js +1 -1
- package/flashphoner-room-api.js +4 -4
- package/flashphoner-room-api.min.js +1 -1
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +4 -4
- package/flashphoner-temasys-flash-websocket.js +4 -4
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +4 -4
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +4 -4
- package/flashphoner.min.js +1 -1
- package/package.json +2 -1
- package/src/constants.d.ts +1 -0
- package/src/flashphoner-core.d.ts +192 -0
- package/src/flashphoner-core.js +4 -4
- package/src/room-module.d.ts +29 -0
- package/examples/demo/streaming/hls-player/videojs-hls.min.js +0 -27
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// eslint-disable-next-line
|
|
2
|
+
'use strict';
|
|
3
|
+
const STREAM_STATUS = require('@flashphoner/websdk').constants.STREAM_STATUS;
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
|
|
7
|
+
// Set default websocket URL
|
|
8
|
+
setURL: function() {
|
|
9
|
+
var proto;
|
|
10
|
+
var url;
|
|
11
|
+
var port;
|
|
12
|
+
if (window.location.protocol === "http:") {
|
|
13
|
+
proto = "ws://";
|
|
14
|
+
port = "8080";
|
|
15
|
+
} else {
|
|
16
|
+
proto = "wss://";
|
|
17
|
+
port = "8443";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
url = proto + window.location.hostname + ":" + port;
|
|
21
|
+
return url;
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
// Get URL parameter by name
|
|
25
|
+
getUrlParam: function (name) {
|
|
26
|
+
var url = window.location.href;
|
|
27
|
+
// eslint-disable-next-line
|
|
28
|
+
name = name.replace(/[\[\]]/g, "\\$&");
|
|
29
|
+
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
|
30
|
+
results = regex.exec(url);
|
|
31
|
+
if (!results) return null;
|
|
32
|
+
if (!results[2]) return '';
|
|
33
|
+
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// Generate simple uuid
|
|
37
|
+
createUUID: function (length) {
|
|
38
|
+
var s = [];
|
|
39
|
+
var hexDigits = "0123456789abcdef";
|
|
40
|
+
for (var i = 0; i < 36; i++) {
|
|
41
|
+
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
42
|
+
}
|
|
43
|
+
s[14] = "4";
|
|
44
|
+
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
|
|
45
|
+
s[8] = s[13] = s[18] = s[23] = "-";
|
|
46
|
+
|
|
47
|
+
var uuid = s.join("");
|
|
48
|
+
|
|
49
|
+
return uuid.substring(0, length);
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
// Helper function to downscale picture size
|
|
53
|
+
downScaleToFitSize: function (videoWidth, videoHeight, dstWidth, dstHeight) {
|
|
54
|
+
var newWidth, newHeight;
|
|
55
|
+
var videoRatio = videoWidth / videoHeight;
|
|
56
|
+
var dstRatio = dstWidth / dstHeight;
|
|
57
|
+
if (dstRatio > videoRatio) {
|
|
58
|
+
newHeight = dstHeight;
|
|
59
|
+
newWidth = Math.floor(videoRatio * dstHeight);
|
|
60
|
+
} else {
|
|
61
|
+
newWidth = dstWidth;
|
|
62
|
+
newHeight = Math.floor(dstWidth / videoRatio);
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
w: newWidth,
|
|
66
|
+
h: newHeight
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Resize video object to fit parent div.
|
|
72
|
+
* Div structure: div WxH -> div wrapper (display) -> video
|
|
73
|
+
* @param video HTML element from resize event target
|
|
74
|
+
*/
|
|
75
|
+
resizeVideo: function (video, width, height) {
|
|
76
|
+
if (!video.parentNode) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (video instanceof HTMLCanvasElement) {
|
|
80
|
+
video.videoWidth = video.width;
|
|
81
|
+
video.videoHeight = video.height;
|
|
82
|
+
}
|
|
83
|
+
var display = video.parentNode;
|
|
84
|
+
var parentSize = {
|
|
85
|
+
w: display.parentNode.clientWidth,
|
|
86
|
+
h: display.parentNode.clientHeight
|
|
87
|
+
};
|
|
88
|
+
var newSize;
|
|
89
|
+
if (width && height) {
|
|
90
|
+
newSize = this.downScaleToFitSize(width, height, parentSize.w, parentSize.h);
|
|
91
|
+
} else {
|
|
92
|
+
newSize = this.downScaleToFitSize(video.videoWidth, video.videoHeight, parentSize.w, parentSize.h);
|
|
93
|
+
}
|
|
94
|
+
display.style.width = newSize.w + "px";
|
|
95
|
+
display.style.height = newSize.h + "px";
|
|
96
|
+
|
|
97
|
+
//vertical align
|
|
98
|
+
var margin = 0;
|
|
99
|
+
if (parentSize.h - newSize.h > 1) {
|
|
100
|
+
margin = Math.floor((parentSize.h - newSize.h) / 2);
|
|
101
|
+
}
|
|
102
|
+
display.style.margin = margin + "px auto";
|
|
103
|
+
console.log("Resize from " + video.videoWidth + "x" + video.videoHeight + " to " + display.offsetWidth + "x" + display.offsetHeight);
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
isPlaying: function (streamStatus) {
|
|
107
|
+
switch(streamStatus) {
|
|
108
|
+
case STREAM_STATUS.PLAYING:
|
|
109
|
+
case STREAM_STATUS.RESIZE:
|
|
110
|
+
case STREAM_STATUS.SNAPSHOT_COMPLETE:
|
|
111
|
+
case STREAM_STATUS.NOT_ENOUGH_BANDWIDTH:
|
|
112
|
+
return true;
|
|
113
|
+
default:
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
package/flashphoner-no-flash.js
CHANGED
|
@@ -10144,7 +10144,7 @@ var createSession = function createSession(options) {
|
|
|
10144
10144
|
mediaProviders: Object.keys(MediaProvider),
|
|
10145
10145
|
keepAlive: keepAlive,
|
|
10146
10146
|
authToken: authToken,
|
|
10147
|
-
clientVersion: "2.0.
|
|
10147
|
+
clientVersion: "2.0.206",
|
|
10148
10148
|
clientOSVersion: window.navigator.appVersion,
|
|
10149
10149
|
clientBrowserVersion: window.navigator.userAgent,
|
|
10150
10150
|
msePacketizationVersion: 2,
|
|
@@ -10370,7 +10370,7 @@ var createSession = function createSession(options) {
|
|
|
10370
10370
|
* @param {HTMLElement} options.localVideoDisplay Div element local video should be displayed in
|
|
10371
10371
|
* @param {HTMLElement} options.remoteVideoDisplay Div element remote video should be displayed in
|
|
10372
10372
|
* @param {Object=} options.custom User provided custom object that will be available in REST App code
|
|
10373
|
-
* @param {
|
|
10373
|
+
* @param {string=} options.stripCodecs Comma separated strings of codecs which should be stripped from WebRTC SDP (ex. "SILK,G722")
|
|
10374
10374
|
* @param {Array<string>=} options.sipSDP Array of custom SDP params (ex. bandwidth (b=))
|
|
10375
10375
|
* @param {Array<string>=} options.sipHeaders Array of custom SIP headers
|
|
10376
10376
|
* @param {string=} options.videoContentHint Video content hint for browser ('detail' by default to maintain resolution), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
|
|
@@ -10632,7 +10632,7 @@ var createSession = function createSession(options) {
|
|
|
10632
10632
|
* @param {Boolean=} answerOptions.receiveAudio Receive audio
|
|
10633
10633
|
* @param {Boolean=} answerOptions.receiveVideo Receive video
|
|
10634
10634
|
* @param {String=} answerOptions.constraints Answer call with constraints
|
|
10635
|
-
* @param {
|
|
10635
|
+
* @param {String=} answerOptions.stripCodecs Comma separated string of codecs which should be stripped from WebRTC SDP (ex. "SILK,G722")
|
|
10636
10636
|
* @param {Array<string>=} answerOptions.sipSDP Array of custom SDP params (ex. bandwidth (b=))
|
|
10637
10637
|
* @param {Array<string>=} answerOptions.sipHeaders Array of custom SIP headers
|
|
10638
10638
|
* @param {sdpHook} sdpHook The callback that handles sdp from the server
|
|
@@ -11212,7 +11212,7 @@ var createSession = function createSession(options) {
|
|
|
11212
11212
|
* @param {HTMLElement} options.display Div element stream should be displayed in
|
|
11213
11213
|
* @param {Object=} options.custom User provided custom object that will be available in REST App code
|
|
11214
11214
|
* @param {Integer} [options.flashBufferTime=0] Specifies how long to buffer messages before starting to display the stream (Flash-only)
|
|
11215
|
-
* @param {
|
|
11215
|
+
* @param {String=} options.stripCodecs Comma separated string of codecs which should be stripped from WebRTC SDP (ex. "H264,PCMA,PCMU,G722")
|
|
11216
11216
|
* @param {string=} options.rtmpUrl Rtmp url stream should be forwarded to
|
|
11217
11217
|
* @param {Object=} options.mediaConnectionConstraints Stream specific constraints for underlying RTCPeerConnection
|
|
11218
11218
|
* @param {Boolean=} options.flashShowFullScreenButton Show full screen button in flash
|