Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

videojs-contrib-media-sources

Package Overview
Dependencies
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

videojs-contrib-media-sources - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

4

package.json
{
"name": "videojs-contrib-media-sources",
"version": "2.2.0",
"version": "2.3.0",
"description": "A Media Source Extensions plugin for video.js",

@@ -42,3 +42,3 @@ "main": "videojs-media-sources.js",

"qunitjs": "^1.14.0",
"video.js": "^5.0.0-rc.93"
"video.js": "^5.1.0"
},

@@ -45,0 +45,0 @@ "dependencies": {

@@ -175,3 +175,10 @@ (function(window, muxjs, undefined){

addSourceBuffer = function(type) {
var audio, video, buffer, codecs;
var
buffer,
codecs,
avcCodec,
mp4aCodec,
avcRegEx = /avc1\.[\da-f]+/i,
mp4aRegEx = /mp4a\.\d+.\d+/i;
// create a virtual source buffer to transmux MPEG-2 transport

@@ -192,3 +199,15 @@ // stream segments into fragmented MP4s

buffer = new VirtualSourceBuffer(this, codecs);
// Pull out each individual codec string if it exists
avcCodec = (codecs.match(avcRegEx) || [])[0];
mp4aCodec = (codecs.match(mp4aRegEx) || [])[0];
// If a codec is unspecified, use the defaults
if (!avcCodec || !avcCodec.length) {
avcCodec = 'avc1.4d400d';
}
if (!mp4aCodec || !mp4aCodec.length) {
mp4aCodec = 'mp4a.40.2';
}
buffer = new VirtualSourceBuffer(this, [avcCodec, mp4aCodec]);
this.virtualBuffers.push(buffer);

@@ -198,2 +217,3 @@ return buffer;

// delegate to the native implementation

@@ -222,6 +242,8 @@ return this.addSourceBuffer_(type);

this.transmuxer_ = new Worker(videojs.MediaSource.webWorkerURI || '/src/transmuxer_worker.js');
this.transmuxer_.postMessage({action:'init', options: {remux: false}});
this.transmuxer_.onmessage = function (event) {
if (event.data.action === 'data') {
var segment = event.data.segment;
var
segment = event.data.segment;

@@ -237,3 +259,3 @@ // Cast to type

// 42c01e & 42c01f
self.videoBuffer_ = mediaSource.addSourceBuffer_('video/mp4;' + (codecs || 'codecs=avc1.4d400d'));
self.videoBuffer_ = mediaSource.addSourceBuffer_('video/mp4;codecs="' + codecs[0] + '"');
self.videoBuffer_.timestampOffset = self.timestampOffset_;

@@ -250,3 +272,3 @@ // aggregate buffer events

if (!self.audioBuffer_) {
self.audioBuffer_ = mediaSource.addSourceBuffer_('audio/mp4;' + (codecs || 'codecs=mp4a.40.2'));
self.audioBuffer_ = mediaSource.addSourceBuffer_('audio/mp4;codecs="' + codecs[1] + '"');
self.audioBuffer_.timestampOffset = self.timestampOffset_;

@@ -263,3 +285,3 @@ // aggregate buffer events

if (!self.videoBuffer_) {
self.videoBuffer_ = mediaSource.addSourceBuffer_('video/mp4;' + (codecs || 'codecs=avc1.4d400d, mp4a.40.2'));
self.videoBuffer_ = mediaSource.addSourceBuffer_('video/mp4;codecs="' + codecs.join(',') + '"');
self.videoBuffer_.timestampOffset = self.timestampOffset_;

@@ -286,3 +308,2 @@ // aggregate buffer events

self.processPendingSegments_();
return;

@@ -625,3 +646,16 @@ }

set: function(value){
var
i,
oldDuration = this.swfObj.vjs_getProperty('duration');
this.swfObj.vjs_setProperty('duration', value);
if (value < oldDuration) {
// In MSE, this triggers the range removal algorithm which causes
// an update to occur
for (i = 0; i < this.sourceBuffers.length; i++) {
this.sourceBuffers[i].remove(value, oldDuration);
}
}
return value;

@@ -652,3 +686,6 @@ }

}
this.readyState = 'ended';
if (this.readyState !== 'ended') {
this.readyState = 'ended';
this.swfObj.vjs_endOfStream();
}
};

@@ -793,5 +830,5 @@

// having this operation act as a no-op is acceptable.
remove: function() {
removeCuesFromTrack(0, Infinity, this.metadataTrack_);
removeCuesFromTrack(0, Infinity, this.inbandTextTrack_);
remove: function(start, end) {
removeCuesFromTrack(start, end, this.metadataTrack_);
removeCuesFromTrack(start, end, this.inbandTextTrack_);
this.trigger({ type: 'update' });

@@ -901,5 +938,2 @@ this.trigger({ type: 'updateend' });

if (this.mediaSource.readyState === 'ended') {
this.mediaSource.swfObj.vjs_endOfStream();
}
}

@@ -916,5 +950,5 @@ },

tech = this.mediaSource.tech_,
start = 0,
targetPts = 0,
i, j, segment,
filteredTags = [],
tags = this.getOrderedTags_(segmentData);

@@ -939,8 +973,10 @@

// skip tags less than the seek target
while (start < tags.length && tags[start].pts < targetPts) {
start++;
// skip tags with a presentation time less than the seek target
for (i = 0; i < tags.length; i++) {
if (tags[i].pts >= targetPts) {
filteredTags.push(tags[i]);
}
}
if (start >= tags.length) {
if (filteredTags.length === 0) {
return;

@@ -950,10 +986,11 @@ }

// concatenate the bytes into a single segment
for (i = start; i < tags.length; i++) {
segmentByteLength += tags[i].bytes.byteLength;
for (i = 0; i < filteredTags.length; i++) {
segmentByteLength += filteredTags[i].bytes.byteLength;
}
segment = new Uint8Array(segmentByteLength);
for (i = start, j = 0; i < tags.length; i++) {
segment.set(tags[i].bytes, j);
j += tags[i].bytes.byteLength;
for (i = 0, j = 0; i < filteredTags.length; i++) {
segment.set(filteredTags[i].bytes, j);
j += filteredTags[i].bytes.byteLength;
}
return segment;

@@ -960,0 +997,0 @@ },

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc