@invintusmedia/tomp4 1.0.4 → 1.0.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invintusmedia/tomp4",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Convert MPEG-TS, fMP4, and HLS streams to MP4 with clipping support - pure JavaScript, zero dependencies",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -20,7 +20,7 @@
20
20
  "scripts": {
21
21
  "build": "node build.js",
22
22
  "dev": "npx serve . -p 3000",
23
- "release": "npm run build && git add -A && git commit -m \"Build v$(node -p \"require('./package.json').version\")\" && git push",
23
+ "release": "npm run build && git add -A && git commit -m \"v$(node -p \"require('./package.json').version\")\" && git tag v$(node -p \"require('./package.json').version\") && git push && git push --tags",
24
24
  "release:patch": "npm version patch --no-git-tag-version && npm run release",
25
25
  "release:minor": "npm version minor --no-git-tag-version && npm run release",
26
26
  "release:major": "npm version major --no-git-tag-version && npm run release",
package/src/hls.js CHANGED
@@ -280,9 +280,11 @@ async function downloadHls(source, options = {}) {
280
280
  toDownload = toDownload.slice(0, options.maxSegments);
281
281
  }
282
282
 
283
- log(`Downloading ${toDownload.length} segment${toDownload.length > 1 ? 's' : ''}...`);
283
+ const totalSegments = toDownload.length;
284
+ log(`Downloading ${totalSegments} segment${totalSegments > 1 ? 's' : ''}...`);
284
285
 
285
- // Download all segments in parallel
286
+ // Download segments with progress tracking
287
+ let completedSegments = 0;
286
288
  const buffers = await Promise.all(
287
289
  toDownload.map(async (seg, i) => {
288
290
  const url = seg.url || seg; // Handle both HlsSegment objects and plain URLs
@@ -290,7 +292,11 @@ async function downloadHls(source, options = {}) {
290
292
  if (!resp.ok) {
291
293
  throw new Error(`Segment ${i + 1} failed: ${resp.status}`);
292
294
  }
293
- return new Uint8Array(await resp.arrayBuffer());
295
+ const buffer = new Uint8Array(await resp.arrayBuffer());
296
+ completedSegments++;
297
+ const percent = Math.round((completedSegments / totalSegments) * 50); // Download is 0-50%
298
+ log(`Downloading: ${percent}%`, { phase: 'download', percent, segment: completedSegments, totalSegments });
299
+ return buffer;
294
300
  })
295
301
  );
296
302
 
@@ -303,7 +309,7 @@ async function downloadHls(source, options = {}) {
303
309
  offset += buf.length;
304
310
  }
305
311
 
306
- log(`Downloaded ${(totalSize / 1024 / 1024).toFixed(2)} MB`);
312
+ log(`Downloaded ${(totalSize / 1024 / 1024).toFixed(2)} MB`, { phase: 'download', percent: 50 });
307
313
 
308
314
  // Return with metadata for precise clipping
309
315
  combined._hlsTimeRange = hasTimeRange ? {
@@ -329,7 +335,7 @@ function isHlsUrl(url) {
329
335
 
330
336
  export {
331
337
  HlsStream,
332
- HlsVariant,
338
+ HlsVariant,
333
339
  HlsSegment,
334
340
  parseHls,
335
341
  downloadHls,
package/src/index.js CHANGED
@@ -33,6 +33,10 @@
33
33
  import { convertTsToMp4, analyzeTsData } from './ts-to-mp4.js';
34
34
  import { convertFmp4ToMp4 } from './fmp4-to-mp4.js';
35
35
  import { parseHls, downloadHls, isHlsUrl, HlsStream, HlsVariant } from './hls.js';
36
+ import { transcode, isWebCodecsSupported } from './transcode.js';
37
+ import { TSMuxer } from './muxers/mpegts.js';
38
+ import { MP4Muxer } from './muxers/mp4.js';
39
+ import { TSParser } from './parsers/mpegts.js';
36
40
 
37
41
  /**
38
42
  * Result object returned by toMp4()
@@ -307,8 +311,12 @@ toMp4.isHlsUrl = isHlsUrl;
307
311
  // Analysis utilities
308
312
  toMp4.analyze = analyzeTsData;
309
313
 
314
+ // Transcoding (browser-only, uses WebCodecs)
315
+ toMp4.transcode = transcode;
316
+ toMp4.isWebCodecsSupported = isWebCodecsSupported;
317
+
310
318
  // Version (injected at build time for dist, read from package.json for ESM)
311
- toMp4.version = '1.0.4';
319
+ toMp4.version = '1.0.6';
312
320
 
313
321
  // Export
314
322
  export {
@@ -325,6 +333,12 @@ export {
325
333
  downloadHls,
326
334
  isHlsUrl,
327
335
  HlsStream,
328
- HlsVariant
336
+ HlsVariant,
337
+ // Transcoding (browser-only)
338
+ transcode,
339
+ TSMuxer,
340
+ MP4Muxer,
341
+ TSParser,
342
+ isWebCodecsSupported
329
343
  };
330
344
  export default toMp4;