Skip to content

Commit

Permalink
remove internal blob conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasSiver committed Feb 19, 2018
1 parent 1f78111 commit ad69943
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 46 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Parameters:
- options.inline `<Boolean>`, check if auto-play is possible for an inline playback, default value is `false`
- options.muted `<Boolean>`, check if auto-play is possible for a muted content
- options.timeout `<Number>`, timeout for a check, default value is `250` ms
- options.blob `<Boolean>`, to use a blob media source instead of base64. Useful to bypass CSP. Default value is `false`

Returns:

Expand All @@ -68,7 +67,6 @@ Parameters:
- options.inline `<Boolean>`, check if auto-play is possible for an inline playback, default value is `false`
- options.muted `<Boolean>`, check if auto-play is possible for a muted content
- options.timeout `<Number>`, timeout for a check, default value is `250` ms
- options.blob `<Boolean>`, to use a blob media source instead of base64. Useful to bypass CSP. Default value is `false`

Returns:

Expand Down
28 changes: 0 additions & 28 deletions lib/base64-to-blob.js

This file was deleted.

21 changes: 5 additions & 16 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/* global URL */

import * as Media from './media'
import base64toBlob from './base64-to-blob'
import audioBlob from '../media/audio.mp3'
import videoBlob from '../media/video.mp4'

function setupDefaultValues (options) {
return Object.assign({
muted: false,
timeout: 250,
inline: false,
blob: false
inline: false
}, options)
}

Expand Down Expand Up @@ -57,27 +54,19 @@ function startPlayback ({muted, timeout, inline}, elementCallback) {
function video (options) {
options = setupDefaultValues(options)
return startPlayback(options, () => {
const source = options.blob
? URL.createObjectURL(base64toBlob(Media.VIDEO))
: Media.VIDEO

return {
element: document.createElement('video'),
source: source
source: videoBlob
}
})
}

function audio (options) {
options = setupDefaultValues(options)
return startPlayback(options, () => {
const source = options.blob
? URL.createObjectURL(base64toBlob(Media.VIDEO))
: Media.AUDIO

return {
element: document.createElement('audio'),
source: source
source: audioBlob
}
})
}
Expand Down

0 comments on commit ad69943

Please sign in to comment.