videomail-client 3.0.0 → 4.0.0

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.
@@ -10,7 +10,6 @@ const Browser = function (options) {
10
10
  const edgeDownload = 'https://www.microsoft.com/en-us/download/details.aspx?id=48126'
11
11
  const chromeDownload = 'http://www.google.com/chrome/'
12
12
  const chromiumDownload = 'http://www.chromium.org/getting-involved/download-chromium'
13
- const browseHappyLink = 'http://browsehappy.com'
14
13
  const ua = defined(
15
14
  options.fakeUaString,
16
15
  typeof window !== 'undefined' && window.navigator && window.navigator.userAgent,
@@ -46,8 +45,6 @@ const Browser = function (options) {
46
45
 
47
46
  const self = this
48
47
 
49
- let videoType
50
-
51
48
  function getRecommendation() {
52
49
  let warning
53
50
 
@@ -148,34 +145,6 @@ const Browser = function (options) {
148
145
  return warning
149
146
  }
150
147
 
151
- function getPlaybackWarning() {
152
- let warning = getRecommendation()
153
-
154
- if (!warning) {
155
- warning =
156
- '<a href="' +
157
- browseHappyLink +
158
- '" target="_blank">Upgrading your browser</a> might help.'
159
- }
160
-
161
- return warning
162
- }
163
-
164
- function canPlayType(video, type) {
165
- let canPlayType
166
-
167
- if (video && video.canPlayType) {
168
- canPlayType = video.canPlayType('video/' + type)
169
- }
170
-
171
- // definitely cannot be played here
172
- if (canPlayType === '') {
173
- return false
174
- }
175
-
176
- return canPlayType
177
- }
178
-
179
148
  // just temporary
180
149
  this.canRecord = function () {
181
150
  const hasNavigator = typeof navigator !== 'undefined'
@@ -257,28 +226,6 @@ const Browser = function (options) {
257
226
  return err
258
227
  }
259
228
 
260
- this.checkPlaybackCapabilities = function (video) {
261
- options.debug('Browser: checkPlaybackCapabilities()')
262
-
263
- let err
264
- let message
265
-
266
- if (!video) {
267
- message = 'No HTML5 support for video tag!'
268
- } else if (!this.getVideoType(video)) {
269
- message = 'Your old browser cannot support modern video codecs'
270
- } else if (!video.setAttribute) {
271
- // fixes "Not implemented" error on older browsers
272
- message = 'Unable to set video attributes in your old browser'
273
- }
274
-
275
- if (message) {
276
- err = VideomailError.create(message, getPlaybackWarning(), options)
277
- }
278
-
279
- return err
280
- }
281
-
282
229
  this.checkBufferTypes = function () {
283
230
  let err
284
231
 
@@ -293,30 +240,6 @@ const Browser = function (options) {
293
240
  return err
294
241
  }
295
242
 
296
- this.getVideoType = function (video) {
297
- if (!video) {
298
- // no type without video
299
- return
300
- }
301
-
302
- if (!videoType) {
303
- // there is a bug in canPlayType within chrome for mp4
304
- if (canPlayType(video, 'mp4') && !chromeBased) {
305
- videoType = 'mp4'
306
- } else if (canPlayType(video, 'webm')) {
307
- videoType = 'webm'
308
- }
309
- }
310
-
311
- if (!videoType || videoType === '') {
312
- // pick this one as a fallback since it's widely used and has
313
- // greatly improved
314
- videoType = 'mp4'
315
- }
316
-
317
- return videoType
318
- }
319
-
320
243
  this.getNoAccessIssue = function () {
321
244
  const message = 'Unable to access webcam'
322
245
  let explanation
@@ -237,6 +237,8 @@ const Recorder = function (visuals, replay, defaultOptions = {}) {
237
237
 
238
238
  key = args.key
239
239
 
240
+ // We are not serving MP4 videos anymore due to licensing but are keeping code
241
+ // for compatibility and documentation
240
242
  if (args.mp4) {
241
243
  replay.setMp4Source(
242
244
  args.mp4 + Constants.SITE_NAME_LABEL + '/' + options.siteName + '/videomail.mp4',
@@ -848,8 +850,7 @@ const Recorder = function (visuals, replay, defaultOptions = {}) {
848
850
  wantedInterval: 1e3 / options.video.fps,
849
851
 
850
852
  intervalSum: getIntervalSum(),
851
- framesCount: framesCount,
852
- videoType: replay.getVideoType()
853
+ framesCount: framesCount
853
854
  }
854
855
 
855
856
  if (options.isAudioEnabled()) {
@@ -995,8 +996,6 @@ const Recorder = function (visuals, replay, defaultOptions = {}) {
995
996
 
996
997
  ctx.drawImage(userMedia.getRawVisuals(), 0, 0, canvas.width, canvas.height)
997
998
 
998
- const nanoseconds = Math.round(window.performance.now() * 1000000)
999
-
1000
999
  recordingBuffer = frame.toBuffer()
1001
1000
  recordingBufferLength = recordingBuffer.length
1002
1001
 
@@ -1007,7 +1006,7 @@ const Recorder = function (visuals, replay, defaultOptions = {}) {
1007
1006
  bytesSum += recordingBufferLength
1008
1007
 
1009
1008
  const timeControlBuffer = Buffer.from(
1010
- stringify({ frameNumber: framesCount, timestamp: nanoseconds })
1009
+ stringify({ frameNumber: framesCount, milliseconds: Date.now() })
1011
1010
  )
1012
1011
  const frameBuffer = Buffer.concat([recordingBuffer, timeControlBuffer])
1013
1012
 
@@ -1,14 +1,13 @@
1
- import util from 'util'
2
- import h from 'hyperscript'
3
- import hidden from 'hidden'
4
1
  import addEventListenerWithOptions from 'add-eventlistener-with-options'
5
-
6
- import Events from './../../events'
7
- import Browser from './../../util/browser'
8
- import EventEmitter from './../../util/eventEmitter'
9
- import VideomailError from './../../util/videomailError'
10
-
2
+ import hidden from 'hidden'
3
+ import h from 'hyperscript'
11
4
  import enableInlineVideo from 'iphone-inline-video'
5
+ import util from 'util'
6
+
7
+ import Events from '../../events'
8
+ import Browser from '../../util/browser'
9
+ import EventEmitter from '../../util/eventEmitter'
10
+ import VideomailError from '../../util/videomailError'
12
11
 
13
12
  const Replay = function (parentElement, options) {
14
13
  EventEmitter.call(this, options, 'Replay')
@@ -85,6 +84,8 @@ const Replay = function (parentElement, options) {
85
84
  this.setWebMSource(videomail.webm)
86
85
  }
87
86
 
87
+ // We are not serving MP4 videos anymore due to licensing but are keeping code
88
+ // for compatibility and documentation
88
89
  if (videomail.mp4) {
89
90
  this.setMp4Source(videomail.mp4)
90
91
  }