Skip to content

Commit

Permalink
fix: typeof minification (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev authored and forbesjo committed Aug 7, 2018
1 parent 2b07fca commit 7c68335
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<script src="node_modules/video.js/dist/alt/video.core.js"></script>
<script src="node_modules/videojs-contrib-eme/dist/videojs-contrib-eme.js"></script>

<script src="dist/videojs-http-streaming.js"></script>
<script src="dist/videojs-http-streaming.min.js"></script>
<script>
(function(window, videojs) {
var player = window.player = videojs('videojs-http-streaming-player', {
Expand Down
3 changes: 0 additions & 3 deletions scripts/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ export default [
external: ['video.js'],
plugins: umdPlugins
.concat([uglify({
compress: {
typeofs: false
},
output: {
comments: 'some'
}
Expand Down
3 changes: 1 addition & 2 deletions src/decrypter-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import window from 'global/window';
import { Decrypter } from 'aes-decrypter';
import { createTransferableMessage } from './bin-utils';

Expand Down Expand Up @@ -28,7 +27,7 @@ const DecrypterWorker = function(self) {
key,
iv,
function(err, bytes) {
window.postMessage(createTransferableMessage({
self.postMessage(createTransferableMessage({
source: data.source,
decrypted: bytes
}), [bytes.buffer]);
Expand Down
20 changes: 10 additions & 10 deletions src/mse/transmuxer-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* transmuxer running inside of a WebWorker by exposing a simple
* message-based interface to a Transmuxer object.
*/
import window from 'global/window';
import mp4 from 'mux.js/lib/mp4';

/**
Expand All @@ -22,7 +21,7 @@ import mp4 from 'mux.js/lib/mp4';
* @param {Object} transmuxer the transmuxer to wire events on
* @private
*/
const wireTransmuxerEvents = function(transmuxer) {
const wireTransmuxerEvents = function(self, transmuxer) {
transmuxer.on('data', function(segment) {
// transfer ownership of the underlying ArrayBuffer
// instead of doing a copy to save memory
Expand All @@ -39,7 +38,7 @@ const wireTransmuxerEvents = function(transmuxer) {
let typedArray = segment.data;

segment.data = typedArray.buffer;
window.postMessage({
self.postMessage({
action: 'data',
segment,
byteOffset: typedArray.byteOffset,
Expand All @@ -49,19 +48,19 @@ const wireTransmuxerEvents = function(transmuxer) {

if (transmuxer.captionStream) {
transmuxer.captionStream.on('data', function(caption) {
window.postMessage({
self.postMessage({
action: 'caption',
data: caption
});
});
}

transmuxer.on('done', function(data) {
window.postMessage({ action: 'done' });
self.postMessage({ action: 'done' });
});

transmuxer.on('gopInfo', function(gopInfo) {
window.postMessage({
self.postMessage({
action: 'gopInfo',
gopInfo
});
Expand All @@ -76,8 +75,9 @@ const wireTransmuxerEvents = function(transmuxer) {
* @param {Object} options the options to initialize with
*/
class MessageHandlers {
constructor(options) {
constructor(self, options) {
this.options = options || {};
this.self = self;
this.init();
}

Expand All @@ -89,7 +89,7 @@ class MessageHandlers {
this.transmuxer.dispose();
}
this.transmuxer = new mp4.Transmuxer(this.options);
wireTransmuxerEvents(this.transmuxer);
wireTransmuxerEvents(this.self, this.transmuxer);
}

/**
Expand Down Expand Up @@ -159,12 +159,12 @@ class MessageHandlers {
const TransmuxerWorker = function(self) {
self.onmessage = function(event) {
if (event.data.action === 'init' && event.data.options) {
this.messageHandlers = new MessageHandlers(event.data.options);
this.messageHandlers = new MessageHandlers(self, event.data.options);
return;
}

if (!this.messageHandlers) {
this.messageHandlers = new MessageHandlers();
this.messageHandlers = new MessageHandlers(self);
}

if (event.data && event.data.action && event.data.action !== 'init') {
Expand Down

0 comments on commit 7c68335

Please sign in to comment.