remove static lib files in favor of npm ones (#773)

* remove static lib files in favor of npm ones

* update howler to work correctly

* patch npm modules to not use window
This commit is contained in:
Connor Turland 2016-10-17 10:39:08 -04:00 committed by GitHub
parent 0ee1b3284a
commit 517cfcb913
7 changed files with 20 additions and 11211 deletions

View file

@ -1,39 +0,0 @@
var attachMediaStream = function (stream, el, options) {
var URL = window.URL;
var opts = {
autoplay: true,
mirror: false,
muted: false
};
var element = el || document.createElement('video');
var item;
if (options) {
for (item in options) {
opts[item] = options[item];
}
}
if (opts.autoplay) element.autoplay = 'autoplay';
if (opts.muted) element.muted = true;
if (opts.mirror) {
['', 'moz', 'webkit', 'o', 'ms'].forEach(function (prefix) {
var styleName = prefix ? prefix + 'Transform' : 'transform';
element.style[styleName] = 'scaleX(-1)';
});
}
// this first one should work most everywhere now
// but we have a few fallbacks just in case.
if (URL && URL.createObjectURL) {
element.src = URL.createObjectURL(stream);
} else if (element.srcObject) {
element.srcObject = stream;
} else if (element.mozSrcObject) {
element.mozSrcObject = stream;
} else {
return false;
}
return element;
};

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,7 @@
/* global Metamaps, $, SocketIoConnection, SimpleWebRTC */ /* global Metamaps, $, SocketIoConnection */
import _ from 'lodash' import _ from 'lodash'
import SimpleWebRTC from 'simplewebrtc'
import Active from './Active' import Active from './Active'
import Control from './Control' import Control from './Control'
@ -36,6 +37,7 @@ const Realtime = {
disconnected: false, disconnected: false,
chatOpen: false, chatOpen: false,
status: true, // stores whether realtime is True/On or False/Off, status: true, // stores whether realtime is True/On or False/Off,
soundId: null,
broadcastingStatus: false, broadcastingStatus: false,
inConversation: false, inConversation: false,
localVideo: null, localVideo: null,
@ -327,8 +329,8 @@ const Realtime = {
invitedToCall: function (inviter) { invitedToCall: function (inviter) {
var self = Realtime var self = Realtime
self.room.chat.sound.stop('sessioninvite') self.room.chat.sound.stop(self.soundId)
self.room.chat.sound.play('sessioninvite') self.soundId = self.room.chat.sound.play('sessioninvite')
var username = self.mappersOnMap[inviter].name var username = self.mappersOnMap[inviter].name
var notifyText = '<img src="' + Metamaps.Erb['junto_spinner_darkgrey.gif'] + '" style="display: inline-block; margin-top: -12px; vertical-align: top;" />' var notifyText = '<img src="' + Metamaps.Erb['junto_spinner_darkgrey.gif'] + '" style="display: inline-block; margin-top: -12px; vertical-align: top;" />'
@ -340,8 +342,8 @@ const Realtime = {
invitedToJoin: function (inviter) { invitedToJoin: function (inviter) {
var self = Realtime var self = Realtime
self.room.chat.sound.stop('sessioninvite') self.room.chat.sound.stop(self.soundId)
self.room.chat.sound.play('sessioninvite') self.soundId = self.room.chat.sound.play('sessioninvite')
var username = self.mappersOnMap[inviter].name var username = self.mappersOnMap[inviter].name
var notifyText = username + ' is inviting you to the conversation. Join?' var notifyText = username + ' is inviting you to the conversation. Join?'
@ -351,7 +353,7 @@ const Realtime = {
}, },
acceptCall: function (userid) { acceptCall: function (userid) {
var self = Realtime var self = Realtime
self.room.chat.sound.stop('sessioninvite') self.room.chat.sound.stop(self.soundId)
self.socket.emit('callAccepted', { self.socket.emit('callAccepted', {
mapid: Active.Map.id, mapid: Active.Map.id,
invited: Active.Mapper.id, invited: Active.Mapper.id,
@ -363,7 +365,7 @@ const Realtime = {
}, },
denyCall: function (userid) { denyCall: function (userid) {
var self = Realtime var self = Realtime
self.room.chat.sound.stop('sessioninvite') self.room.chat.sound.stop(self.soundId)
self.socket.emit('callDenied', { self.socket.emit('callDenied', {
mapid: Active.Map.id, mapid: Active.Map.id,
invited: Active.Mapper.id, invited: Active.Mapper.id,
@ -373,7 +375,7 @@ const Realtime = {
}, },
denyInvite: function (userid) { denyInvite: function (userid) {
var self = Realtime var self = Realtime
self.room.chat.sound.stop('sessioninvite') self.room.chat.sound.stop(self.soundId)
self.socket.emit('inviteDenied', { self.socket.emit('inviteDenied', {
mapid: Active.Map.id, mapid: Active.Map.id,
invited: Active.Mapper.id, invited: Active.Mapper.id,

View file

@ -1,4 +1,4 @@
/* global Metamaps, $, Howl */ /* global Metamaps, $ */
/* /*
* Dependencies: * Dependencies:
@ -6,6 +6,7 @@
*/ */
import Backbone from 'backbone' import Backbone from 'backbone'
import { Howl } from 'howler'
import Autolinker from 'autolinker' import Autolinker from 'autolinker'
import _ from 'lodash' import _ from 'lodash'
import underscore from 'underscore' import underscore from 'underscore'
@ -127,7 +128,7 @@ var Private = {
}, },
initializeSounds: function () { initializeSounds: function () {
this.sound = new Howl({ this.sound = new Howl({
urls: [Metamaps.Erb['sounds/MM_sounds.mp3'], Metamaps.Erb['sounds/MM_sounds.ogg']], src: [Metamaps.Erb['sounds/MM_sounds.mp3'], Metamaps.Erb['sounds/MM_sounds.ogg']],
sprite: { sprite: {
joinmap: [0, 561], joinmap: [0, 561],
leavemap: [1000, 592], leavemap: [1000, 592],

View file

@ -1,6 +1,8 @@
/* global Metamaps, $ */ /* global Metamaps, $ */
import Backbone from 'backbone' import Backbone from 'backbone'
import attachMediaStream from 'attachmediastream'
// TODO is this line good or bad // TODO is this line good or bad
// Backbone.$ = window.$ // Backbone.$ = window.$
@ -21,7 +23,6 @@ const Room = function(opts) {
this.isActiveRoom = false this.isActiveRoom = false
this.socket = opts.socket this.socket = opts.socket
this.webrtc = opts.webrtc this.webrtc = opts.webrtc
//this.roomRef = opts.firebase
this.room = opts.room this.room = opts.room
this.config = opts.config this.config = opts.config
this.peopleCount = 0 this.peopleCount = 0

View file

@ -18,6 +18,7 @@
}, },
"homepage": "https://github.com/metamaps/metamaps#readme", "homepage": "https://github.com/metamaps/metamaps#readme",
"dependencies": { "dependencies": {
"attachmediastream": "1.4.1",
"autolinker": "0.17.1", "autolinker": "0.17.1",
"babel-cli": "6.14.0", "babel-cli": "6.14.0",
"babel-loader": "6.2.5", "babel-loader": "6.2.5",
@ -28,6 +29,9 @@
"backbone": "1.0.0", "backbone": "1.0.0",
"commonmark": "0.26.0", "commonmark": "0.26.0",
"csv-parse": "1.1.7", "csv-parse": "1.1.7",
"getScreenMedia": "git://github.com/devvmh/getScreenMedia#patch-1",
"hark": "git://github.com/devvmh/hark#patch-1",
"howler": "2.0.1",
"json-loader": "0.5.4", "json-loader": "0.5.4",
"lodash": "4.16.1", "lodash": "4.16.1",
"node-uuid": "1.4.7", "node-uuid": "1.4.7",
@ -35,6 +39,7 @@
"react": "15.3.2", "react": "15.3.2",
"react-dom": "15.3.2", "react-dom": "15.3.2",
"react-dropzone": "3.6.0", "react-dropzone": "3.6.0",
"simplewebrtc": "2.2.0",
"socket.io": "0.9.12", "socket.io": "0.9.12",
"underscore": "1.4.4", "underscore": "1.4.4",
"webpack": "1.13.2" "webpack": "1.13.2"