decoupling.diff 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. diff --git a/lib/dataconnection.ts b/lib/dataconnection.ts
  2. index ab58d6c..dfbf3b2 100644
  3. --- a/lib/dataconnection.ts
  4. +++ b/lib/dataconnection.ts
  5. @@ -56,7 +56,7 @@ export class DataConnection extends BaseConnection {
  6. this.options.connectionId || DataConnection.ID_PREFIX + util.randomToken();
  7. this.label = this.options.label || this.connectionId;
  8. - this.serialization = this.options.serialization || SerializationType.Binary;
  9. + this.serialization = this.options.serialization || SerializationType.JSON;
  10. this.reliable = !!this.options.reliable;
  11. if (this.options._payload) {
  12. diff --git a/lib/exports.ts b/lib/exports.ts
  13. index 5772d02..07fc457 100644
  14. --- a/lib/exports.ts
  15. +++ b/lib/exports.ts
  16. @@ -8,6 +8,3 @@ export const peerjs = {
  17. export default Peer;
  18. -(<any>window).peerjs = peerjs;
  19. -/** @deprecated Should use peerjs namespace */
  20. -(<any>window).Peer = Peer;
  21. diff --git a/lib/peer.ts b/lib/peer.ts
  22. index 66a3412..78ac6cf 100644
  23. --- a/lib/peer.ts
  24. +++ b/lib/peer.ts
  25. @@ -111,11 +111,6 @@ export class Peer extends EventEmitter {
  26. };
  27. this._options = options;
  28. - // Detect relative URL host.
  29. - if (this._options.host === "/") {
  30. - this._options.host = window.location.hostname;
  31. - }
  32. -
  33. // Set path correctly.
  34. if (this._options.path) {
  35. if (this._options.path[0] !== "/") {
  36. diff --git a/lib/supports.ts b/lib/supports.ts
  37. index 1801188..8bb163e 100644
  38. --- a/lib/supports.ts
  39. +++ b/lib/supports.ts
  40. @@ -1,5 +1,3 @@
  41. -import { webRTCAdapter } from './adapter';
  42. -
  43. export const Supports = new class {
  44. readonly isIOS = ['iPad', 'iPhone', 'iPod'].includes(navigator.platform);
  45. readonly supportedBrowsers = ['firefox', 'chrome', 'safari'];
  46. @@ -28,36 +26,15 @@ export const Supports = new class {
  47. }
  48. getBrowser(): string {
  49. - return webRTCAdapter.browserDetails.browser;
  50. + return 'chrome';
  51. }
  52. getVersion(): number {
  53. - return webRTCAdapter.browserDetails.version || 0;
  54. + return this.minChromeVersion;
  55. }
  56. isUnifiedPlanSupported(): boolean {
  57. - const browser = this.getBrowser();
  58. - const version = webRTCAdapter.browserDetails.version || 0;
  59. -
  60. - if (browser === 'chrome' && version < 72) return false;
  61. - if (browser === 'firefox' && version >= 59) return true;
  62. - if (!window.RTCRtpTransceiver || !('currentDirection' in RTCRtpTransceiver.prototype)) return false;
  63. -
  64. - let tempPc: RTCPeerConnection;
  65. - let supported = false;
  66. -
  67. - try {
  68. - tempPc = new RTCPeerConnection();
  69. - tempPc.addTransceiver('audio');
  70. - supported = true;
  71. - } catch (e) { }
  72. - finally {
  73. - if (tempPc) {
  74. - tempPc.close();
  75. - }
  76. - }
  77. -
  78. - return supported;
  79. + return false;
  80. }
  81. toString(): string {