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

@cocreate/elements

Package Overview
Dependencies
Maintainers
1
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/elements - npm Package Compare versions

Comparing version 1.35.0 to 1.35.1

2

package.json
{
"name": "@cocreate/elements",
"version": "1.35.0",
"version": "1.35.1",
"description": "Fetch content into any html element by using html5 attributes to query data stored in CoCreate headless CMS. If data is changed it will instantly reflect in html tags as changes are broadcasted in realtime",

@@ -5,0 +5,0 @@ "keywords": [

@@ -36,18 +36,36 @@ import observer from '@cocreate/observer';

const mediaSource = new MediaSource();
video.src = URL.createObjectURL(mediaSource);
element.src = URL.createObjectURL(mediaSource);
mediaSource.addEventListener('sourceopen', async () => {
const contentType = response.headers.get("Content-Type");
sourceBuffer = mediaSource.addSourceBuffer(contentType);
sourceBuffer = mediaSource.addSourceBuffer(`${mediaConfig['content-type']}; codecs="${mediaConfig.codecs}"`);
sourceBuffer.addEventListener('updateend', () => {
console.log('Update ended, buffered ranges:', sourceBuffer.buffered)
if (!sourceBuffer.updating && mediaSource.readyState === 'open') {
mediaSource.endOfStream();
video.addEventListener('ended', () => {
URL.revokeObjectURL(video.src);
element.addEventListener('ended', () => {
URL.revokeObjectURL(element.src);
});
}
});
sourceBuffer.addEventListener('error', (e) => {
console.error('SourceBuffer error event:', e);
console.log('MediaSource readyState:', mediaSource.readyState);
console.log('SourceBuffer updating:', sourceBuffer.updating);
console.log('SourceBuffer buffered ranges:', sourceBuffer.buffered);
// Any other state information you can log
});
getSegment(sourceBuffer, mediaConfig.segments[0])
});
mediaSource.addEventListener('sourceended', () => {
console.log('MediaSource ended event fired');
});
mediaSource.addEventListener('sourceclose', () => {
console.log('MediaSource close event fired');
});
// Event listener for seeking

@@ -57,3 +75,2 @@ element.addEventListener('seeking', () => {

let chunkIndex = Math.floor(currentTime / chunkDuration);
});

@@ -79,4 +96,4 @@

element.addEventListener('timeupdate', function () {
const bufferEnd = video.buffered.end(0);
const currentTime = video.currentTime;
const bufferEnd = element.buffered.end(0);
const currentTime = element.currentTime;
const threshold = 10; // seconds before buffer end to fetch the next segment

@@ -89,4 +106,5 @@

});
} catch (error) {
video.src = src
element.src = src
// let blob = await response.json();

@@ -113,10 +131,10 @@ // URL.createObjectURL(blob);

async function getSegment(sourceBuffer, segmentConfig) {
async function getSegment(sourceBuffer, segment) {
// TODO: use socket/crud/file with room using the url to get one or more segments and append
let segments = []
if (segmentConfig.array && segmentConfig.object) {
let data = { method: 'object.read', ...segmentConfig }
let data
if (segment.array && segment.object) {
data = { method: 'object.read', ...segment }
data = await crud.send(data)
if (segmentConfig.key) {
if (segment.key) {
// TODO: utils.getValuefromObject

@@ -129,5 +147,11 @@ if (Array.isArray(data.object[0][key]))

segments.push(...data.object)
} else if (segmentConfig.src) {
data = await fetch(src);
segment.src = segments[0]
segment.src = await segment.src.text();
// TODO: handle segment array as
} else if (segment.src) {
// TODO: handle 404, or whether src was fetched or not
segment.src = await fetch(segment.src);
segment.src = await segment.src.text();
}
appendSegment(sourceBuffer, segment)

@@ -149,3 +173,5 @@ }

} else {
console.error("Unhandled segment data type");
arrayBuffer = base64ToArrayBuffer(segment.src);
// arrayBuffer = await segment.src.arrayBuffer();
}

@@ -157,2 +183,3 @@

sourceBuffer.appendBuffer(arrayBuffer);
console.log(sourceBuffer)
}

@@ -159,0 +186,0 @@

@@ -1298,2 +1298,2 @@ /********************************************************************************

export default { init, read, save, getData, getObject, reset, elements, keys, forms, debounce, getAttributes };
export default { init, read, save, getData, getObject, reset, elements, keys, forms, debounce, getAttributes, setTypeValue };

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