mediasoup-client
Advanced tools
Comparing version 0.0.1-pre to 0.1.0
185
.eslintrc.js
module.exports = | ||
{ | ||
env : | ||
env: | ||
{ | ||
'browser' : true, | ||
'es6' : true, | ||
'commonjs' : true | ||
browser: true, | ||
es6: true, | ||
node: true | ||
}, | ||
plugins : | ||
plugins: | ||
[ | ||
'import' | ||
], | ||
extends : | ||
extends: | ||
[ | ||
'eslint:recommended' | ||
], | ||
settings : {}, | ||
parserOptions : | ||
settings: {}, | ||
parserOptions: | ||
{ | ||
ecmaVersion : 6, | ||
sourceType : 'module', | ||
ecmaFeatures : | ||
ecmaVersion: 6, | ||
sourceType: 'module', | ||
ecmaFeatures: | ||
{ | ||
impliedStrict : true | ||
impliedStrict: true | ||
} | ||
}, | ||
rules : | ||
rules: | ||
{ | ||
'no-console' : 0, | ||
'no-undef' : 2, | ||
'no-unused-vars' : [ 1, { vars: 'all', args: 'after-used' }], | ||
'no-empty' : 0, | ||
'quotes' : [ 2, 'single', { avoidEscape: true } ], | ||
'semi' : [ 2, 'always' ], | ||
'no-multi-spaces' : 0, | ||
'no-whitespace-before-property' : 2, | ||
'space-before-blocks' : 2, | ||
'space-before-function-paren' : [ 2, 'never' ], | ||
'space-in-parens' : [ 2, 'never' ], | ||
'spaced-comment' : [ 2, 'always' ], | ||
'comma-spacing' : [ 2, { before: false, after: true } ], | ||
'import/extensions' : 2 | ||
'array-bracket-spacing': [ 2, 'always', | ||
{ | ||
objectsInArrays: true, | ||
arraysInArrays: true | ||
}], | ||
'arrow-parens': [ 2, 'always' ], | ||
'arrow-spacing': 2, | ||
'block-spacing': [ 2, 'always' ], | ||
'brace-style': [ 2, 'allman', { allowSingleLine: true } ], | ||
'camelcase': 2, | ||
'comma-dangle': 2, | ||
'comma-spacing': [ 2, { before: false, after: true } ], | ||
'comma-style': 2, | ||
'computed-property-spacing': 2, | ||
'constructor-super': 2, | ||
'func-call-spacing': 2, | ||
'generator-star-spacing': 2, | ||
'guard-for-in': 2, | ||
'indent': [ 2, 'tab', { 'SwitchCase': 1 } ], | ||
'key-spacing': [ 2, | ||
{ | ||
singleLine: | ||
{ | ||
beforeColon: false, | ||
afterColon: true | ||
}, | ||
multiLine: | ||
{ | ||
beforeColon: true, | ||
afterColon: true, | ||
align: 'colon' | ||
} | ||
}], | ||
'keyword-spacing': 2, | ||
'linebreak-style': [ 2, 'unix' ], | ||
'lines-around-comment': [ 2, | ||
{ | ||
allowBlockStart: true, | ||
allowObjectStart: true, | ||
beforeBlockComment: true, | ||
beforeLineComment: false | ||
}], | ||
'max-len': [ 2, 90, | ||
{ | ||
tabWidth: 2, | ||
comments: 110, | ||
ignoreUrls: true, | ||
ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
ignoreRegExpLiterals: true | ||
}], | ||
'newline-after-var': 2, | ||
'newline-before-return': 2, | ||
'newline-per-chained-call': 2, | ||
'no-alert': 2, | ||
'no-caller': 2, | ||
'no-case-declarations': 2, | ||
'no-catch-shadow': 2, | ||
'no-class-assign': 2, | ||
'no-confusing-arrow': 2, | ||
'no-console': 2, | ||
'no-const-assign': 2, | ||
'no-debugger': 2, | ||
'no-dupe-args': 2, | ||
'no-dupe-keys': 2, | ||
'no-duplicate-case': 2, | ||
'no-div-regex': 2, | ||
'no-empty': [ 2, { allowEmptyCatch: true } ], | ||
'no-empty-pattern': 2, | ||
'no-else-return': 0, | ||
'no-eval': 2, | ||
'no-extend-native': 2, | ||
'no-ex-assign': 2, | ||
'no-extra-bind': 2, | ||
'no-extra-boolean-cast': 2, | ||
'no-extra-label': 2, | ||
'no-extra-semi': 2, | ||
'no-fallthrough': 2, | ||
'no-func-assign': 2, | ||
'no-global-assign': 2, | ||
'no-implicit-coercion': 2, | ||
'no-implicit-globals': 2, | ||
'no-inner-declarations': 2, | ||
'no-invalid-regexp': 2, | ||
'no-invalid-this': 2, | ||
'no-irregular-whitespace': 2, | ||
'no-lonely-if': 2, | ||
'no-mixed-operators': 2, | ||
'no-mixed-spaces-and-tabs': 2, | ||
'no-multi-spaces': 2, | ||
'no-multi-str': 2, | ||
'no-multiple-empty-lines': 2, | ||
'no-native-reassign': 2, | ||
'no-negated-in-lhs': 2, | ||
'no-new': 2, | ||
'no-new-func': 2, | ||
'no-new-wrappers': 2, | ||
'no-obj-calls': 2, | ||
'no-proto': 2, | ||
'no-prototype-builtins': 0, | ||
'no-redeclare': 2, | ||
'no-regex-spaces': 2, | ||
'no-restricted-imports': 2, | ||
'no-return-assign': 2, | ||
'no-self-assign': 2, | ||
'no-self-compare': 2, | ||
'no-sequences': 2, | ||
'no-shadow': 2, | ||
'no-shadow-restricted-names': 2, | ||
'no-spaced-func': 2, | ||
'no-sparse-arrays': 2, | ||
'no-this-before-super': 2, | ||
'no-throw-literal': 2, | ||
'no-undef': 2, | ||
'no-unexpected-multiline': 2, | ||
'no-unmodified-loop-condition': 2, | ||
'no-unreachable': 2, | ||
'no-unused-vars': [ 1, { vars: 'all', args: 'after-used' }], | ||
'no-use-before-define': [ 2, { functions: false } ], | ||
'no-useless-call': 2, | ||
'no-useless-computed-key': 2, | ||
'no-useless-concat': 2, | ||
'no-useless-rename': 2, | ||
'no-var': 2, | ||
'no-whitespace-before-property': 2, | ||
'object-curly-newline': 0, | ||
'object-curly-spacing': [ 2, 'always' ], | ||
'object-property-newline': [ 2, { allowMultiplePropertiesPerLine: true } ], | ||
'prefer-const': 2, | ||
'prefer-rest-params': 2, | ||
'prefer-spread': 2, | ||
'prefer-template': 2, | ||
'quotes': [ 2, 'single', { avoidEscape: true } ], | ||
'semi': [ 2, 'always' ], | ||
'semi-spacing': 2, | ||
'space-before-blocks': 2, | ||
'space-before-function-paren': [ 2, 'never' ], | ||
'space-in-parens': [ 2, 'never' ], | ||
'spaced-comment': [ 2, 'always' ], | ||
'strict': 2, | ||
'valid-typeof': 2, | ||
'yoda': 2, | ||
// eslint-plugin-import options. | ||
'import/extensions': 2, | ||
'import/no-duplicates': 2 | ||
} | ||
}; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
'use strict'; // eslint-disable-line strict | ||
@@ -10,3 +10,3 @@ const fs = require('fs'); | ||
const browserify = require('browserify'); | ||
const uglify = require('gulp-uglify'); | ||
const uglify = require('gulp-uglify'); // TODO: TMP | ||
const source = require('vinyl-source-stream'); | ||
@@ -26,3 +26,3 @@ const buffer = require('vinyl-buffer'); | ||
{ | ||
let src = [ 'gulpfile.js', 'lib/**/*.js' ]; | ||
const src = [ 'gulpfile.js', '.eslintrc.js', 'lib/**/*.js' ]; | ||
@@ -51,22 +51,14 @@ return gulp.src(src) | ||
}) | ||
.transform('babelify', | ||
{ | ||
presets : [ 'es2015' ], | ||
plugins : [ 'transform-runtime', 'transform-object-assign' ] | ||
}) | ||
.bundle() | ||
.on('error', logError) | ||
.pipe(source(`${PKG.name}.js`)) | ||
.pipe(buffer()) | ||
.pipe(rename(`${PKG.name}.js`)) | ||
.pipe(uglify()) | ||
.pipe(header(BANNER, { pkg: PKG })) | ||
.pipe(gulp.dest('dist/')); | ||
.on('error', logError) | ||
.pipe(source(`${PKG.name}.js`)) | ||
.pipe(buffer()) | ||
.pipe(rename(`${PKG.name}.js`)) | ||
.pipe(uglify()) | ||
.pipe(header(BANNER, { pkg: PKG })) | ||
.pipe(gulp.dest('dist/')); | ||
}); | ||
gulp.task('dist', gulp.series( | ||
'lint', | ||
'bundle' | ||
)); | ||
gulp.task('dist', gulp.series('lint', 'bundle')); | ||
gulp.task('default', gulp.series('lint')); |
@@ -1,80 +0,134 @@ | ||
'use strict'; | ||
import bowser from 'bowser'; | ||
import Logger from './Logger'; | ||
import Chrome55 from './handlers/Chrome55'; | ||
import Safari11 from './handlers/Safari11'; | ||
import Firefox50 from './handlers/Firefox50'; | ||
import Edge11 from './handlers/Edge11'; | ||
const logger = new Logger('Device'); | ||
/** | ||
* Class with static members representing the underlying device or browser. | ||
*/ | ||
export default class Device | ||
{ | ||
static initialize() | ||
/** | ||
* Get the device name. | ||
* | ||
* @return {String} | ||
*/ | ||
static get name() | ||
{ | ||
// Browser name. | ||
// @type {String} | ||
this._browser = bowser.name; | ||
if (!Device._detected) | ||
Device._detect(); | ||
// Browser version. | ||
// @type {String} | ||
this._version = bowser.version; | ||
return Device._name; | ||
} | ||
// Whether this device is supported by mediasoup-client. | ||
// @type {Boolean} | ||
this._supported = false; | ||
/** | ||
* Get the device version. | ||
* | ||
* @return {String} | ||
*/ | ||
static get version() | ||
{ | ||
if (!Device._detected) | ||
Device._detect(); | ||
// TODO: version checks. | ||
return Device._version; | ||
} | ||
if ( | ||
bowser.chrome || bowser.chromium || bowser.blink || bowser.webkit | ||
) | ||
/** | ||
* Whether this device is supported. | ||
* | ||
* @return {Boolean} | ||
*/ | ||
static isSupported() | ||
{ | ||
if (!Device._detected) | ||
Device._detect(); | ||
return Boolean(Device._handlerClass); | ||
} | ||
/** | ||
* Returns a suitable WebRTC handler class. | ||
* | ||
* @type {Class} | ||
*/ | ||
static get Handler() | ||
{ | ||
if (!Device._detected) | ||
Device._detect(); | ||
return Device._handlerClass; | ||
} | ||
/** | ||
* Detects the current device/browser. | ||
* | ||
* @private | ||
*/ | ||
static _detect() | ||
{ | ||
const ua = global.navigator.userAgent; | ||
const browser = bowser._detect(ua); | ||
Device._detected = true; | ||
Device._name = browser.name || 'unknown device'; | ||
Device._version = browser.version || 'unknown vesion'; | ||
Device._handlerClass = null; | ||
// Chrome, Chromium, Opera (desktop and mobile). | ||
if (bowser.check({ chrome: '55', chromium: '55', opera: '44' }, true, ua)) | ||
{ | ||
this._supported = true; | ||
Device._handlerClass = Chrome55; | ||
} | ||
if ( | ||
bowser.opera | ||
) | ||
// Safari (desktop and mobile). | ||
else if (bowser.check({ safari: '11' }, true, ua)) | ||
{ | ||
this._supported = true; | ||
Device._handlerClass = Safari11; | ||
} | ||
if ( | ||
bowser.safari | ||
) | ||
// Firefox (desktop and mobile). | ||
else if (bowser.check({ firefox: '50' }, true, ua)) | ||
{ | ||
this._supported = true; | ||
Device._handlerClass = Firefox50; | ||
} | ||
if ( | ||
bowser.firefox || bowser.gecko | ||
) | ||
// Edge (desktop). | ||
else if (bowser.check({ msedge: '11' }, true, ua)) | ||
{ | ||
this._supported = true; | ||
Device._handlerClass = Edge11; | ||
} | ||
if ( | ||
bowser.msedge | ||
) | ||
// TODO: More devices. | ||
if (Device.isSupported()) | ||
{ | ||
this._supported = true; | ||
logger.debug( | ||
'device supported [name:%s, version:%s, handler:%s]', | ||
Device._name, Device._version, Device._handlerClass.name); | ||
} | ||
logger.debug( | ||
'[browser:%s, version:%s, supported:%s]', | ||
this._browser, this._version, this._supported); | ||
else | ||
{ | ||
logger.warn( | ||
'device not supported [name:%s, version:%s]', | ||
Device._name, Device._version); | ||
} | ||
} | ||
} | ||
static get browser() | ||
{ | ||
return this._browser; | ||
} | ||
// Initialized flag. | ||
// @type {Boolean} | ||
Device._detected = false; | ||
static get version() | ||
{ | ||
return this._version; | ||
} | ||
// Device name. | ||
// @type {String} | ||
Device._name = undefined; | ||
static get supported() | ||
{ | ||
return this._supported; | ||
} | ||
} | ||
// Device version. | ||
// @type {String} | ||
Device._version = undefined; | ||
// WebRTC hander for this device. | ||
// @type {Class} | ||
Device._handlerClass = null; |
@@ -1,10 +0,41 @@ | ||
'use strict'; | ||
import Device from './Device'; | ||
import Client from './Client'; | ||
import Room from './Room'; | ||
// Initialize Device. | ||
Device.initialize(); | ||
/** | ||
* Whether the current browser or device is supported. | ||
* | ||
* @return {Boolean} | ||
* | ||
* @example | ||
* isDeviceSupported() | ||
* // => true | ||
*/ | ||
export function isDeviceSupported() | ||
{ | ||
return Device.isSupported(); | ||
} | ||
export { Device }; | ||
export { Client }; | ||
/** | ||
* Get information regarding the current browser or device. | ||
* | ||
* @return {Object} - Object with `name` (String) and version {String}. | ||
* | ||
* @example | ||
* getDeviceInfo() | ||
* // => { name: "Chrome", version: "59.0" } | ||
*/ | ||
export function getDeviceInfo() | ||
{ | ||
return { | ||
name : Device.name, | ||
version : Device.version | ||
}; | ||
} | ||
/** | ||
* Expose the Room class. | ||
* | ||
* @example | ||
* const room = new Room();` | ||
*/ | ||
export { Room }; |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
import debug from 'debug'; | ||
@@ -13,5 +11,5 @@ | ||
{ | ||
this._debug = debug(APP_NAME + ':' + prefix); | ||
this._warn = debug(APP_NAME + ':WARN:' + prefix); | ||
this._error = debug(APP_NAME + ':ERROR:' + prefix); | ||
this._debug = debug(`${APP_NAME}:${prefix}`); | ||
this._warn = debug(`${APP_NAME}:WARN:${prefix}`); | ||
this._error = debug(`${APP_NAME}:ERROR:${prefix}`); | ||
} | ||
@@ -21,9 +19,11 @@ else | ||
this._debug = debug(APP_NAME); | ||
this._warn = debug(APP_NAME + ':WARN'); | ||
this._error = debug(APP_NAME + ':ERROR'); | ||
this._warn = debug(`${APP_NAME}:WARN`); | ||
this._error = debug(`${APP_NAME}:ERROR`); | ||
} | ||
/* eslint-disable no-console */ | ||
this._debug.log = console.info.bind(console); | ||
this._warn.log = console.warn.bind(console); | ||
this._error.log = console.error.bind(console); | ||
/* eslint-enable no-console */ | ||
} | ||
@@ -30,0 +30,0 @@ |
{ | ||
"name": "mediasoup-client", | ||
"version": "0.0.1-pre", | ||
"version": "0.1.0", | ||
"description": "mediasoup client SDK for mediasoup 2.X", | ||
@@ -9,19 +9,37 @@ "author": "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)", | ||
"dependencies": { | ||
"babel-runtime": "^6.23.0", | ||
"bowser": "^1.7.0", | ||
"classnames": "^2.2.5", | ||
"debug": "^2.6.8", | ||
"random-string": "^0.2.0" | ||
"bowser": "^1.7.1", | ||
"debug": "^3.0.0", | ||
"random-number": "0.0.7", | ||
"sdp-transform": "^2.3.0", | ||
"supports-color": "^4.2.1" | ||
}, | ||
"browserify": { | ||
"transform": [ | ||
[ | ||
"babelify", | ||
{ | ||
"presets": [ | ||
"es2015" | ||
], | ||
"plugins": [ | ||
"transform-runtime", | ||
"transform-object-assign" | ||
] | ||
} | ||
] | ||
] | ||
}, | ||
"devDependencies": { | ||
"babel-plugin-transform-object-assign": "^6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"babelify": "^7.3.0", | ||
"browserify": "^14.4.0", | ||
"eslint": "^3.19.0", | ||
"eslint-plugin-import": "^2.3.0", | ||
"eslint": "^4.4.1", | ||
"eslint-plugin-import": "^2.7.0", | ||
"gulp": "git://github.com/gulpjs/gulp.git#4.0", | ||
"gulp-eslint": "^3.0.1", | ||
"gulp-header": "^1.8.8", | ||
"gulp-eslint": "^4.0.0", | ||
"gulp-header": "^1.8.9", | ||
"gulp-plumber": "^1.1.0", | ||
@@ -28,0 +46,0 @@ "gulp-rename": "^1.2.2", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
161090
34
5729
0
179
18
1
+ Addedrandom-number@0.0.7
+ Addedsdp-transform@^2.3.0
+ Addedsupports-color@^4.2.1
+ Addeddebug@3.2.7(transitive)
+ Addedhas-flag@2.0.0(transitive)
+ Addedms@2.1.3(transitive)
+ Addedrandom-number@0.0.7(transitive)
+ Addedsdp-transform@2.15.0(transitive)
+ Addedsupports-color@4.5.0(transitive)
- Removedbabel-runtime@^6.23.0
- Removedclassnames@^2.2.5
- Removedrandom-string@^0.2.0
- Removedbabel-runtime@6.26.0(transitive)
- Removedclassnames@2.5.1(transitive)
- Removedcore-js@2.6.12(transitive)
- Removeddebug@2.6.9(transitive)
- Removedms@2.0.0(transitive)
- Removedrandom-string@0.2.0(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
Updatedbowser@^1.7.1
Updateddebug@^3.0.0