@soga/mediainfo 0.0.4 → 0.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/dist/m3u8.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { M3U8Manifest } from './m3u8.types';
2
+ export declare function parseM3U8(input: string): Promise<{
3
+ duration: number;
4
+ data: M3U8Manifest;
5
+ input: string;
6
+ }>;
package/dist/m3u8.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.parseM3U8=parseM3U8;const fs_extra_1=require("fs-extra"),m3u8_parser_1=require("m3u8-parser"),path_1=require("path");async function parseM3U8(e){const t=Date.now(),r=new m3u8_parser_1.Parser,s=await(0,fs_extra_1.readFile)(e,"utf8");r.push(s),r.end();const a=r.manifest,i=(0,path_1.dirname)(e),n=a.segments[0].map.uri,u=(0,path_1.resolve)(i,n),_={uri:n,folder:i,file_path:u,size:(await(0,fs_extra_1.stat)(u)).size};let o=0;const p=1e6,d=[],{length:f}=a.segments;for(let e=0;e<f;e++){const t=a.segments[e],r=(0,path_1.resolve)(i,t.uri),s=await(0,fs_extra_1.stat)(r),u=t.duration*p,_=o/p,f=(o+u)/p;d.push({index:e,duration:t.duration,init_uri:n,uri:t.uri,file_path:r,size:s.size,start_time:_,end_time:f,folder:i}),o+=u}const l={init:_,...a,segments:d};return{duration:Date.now()-t,data:l,input:e}}
@@ -0,0 +1,35 @@
1
+ type CommonManifest = {
2
+ version: number;
3
+ targetDuration: number;
4
+ mediaSequence: number;
5
+ endList: boolean;
6
+ };
7
+ export type RawManifest = CommonManifest & {
8
+ segments: {
9
+ duration: number;
10
+ uri: string;
11
+ map: {
12
+ uri: string;
13
+ };
14
+ }[];
15
+ };
16
+ export type SegmentInfo = {
17
+ index: number;
18
+ duration: number;
19
+ init_uri: string;
20
+ uri: string;
21
+ file_path: string;
22
+ folder: string;
23
+ size: number;
24
+ start_time: number;
25
+ end_time: number;
26
+ };
27
+ export type M3U8Manifest = CommonManifest & {
28
+ init: {
29
+ uri: string;
30
+ file_path: string;
31
+ size: number;
32
+ };
33
+ segments: SegmentInfo[];
34
+ };
35
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
package/dist/main.d.ts CHANGED
@@ -2,3 +2,7 @@ export * from './mediainfo';
2
2
  export * from './mediainfo.types';
3
3
  export * from './mp4box';
4
4
  export * from './mp4box.types';
5
+ export * from './resolution';
6
+ export * from './resolution.types';
7
+ export * from './m3u8';
8
+ export * from './m3u8.types';
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./mediainfo"),exports),__exportStar(require("./mediainfo.types"),exports),__exportStar(require("./mp4box"),exports),__exportStar(require("./mp4box.types"),exports);
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,o){void 0===o&&(o=t);var i=Object.getOwnPropertyDescriptor(r,t);i&&!("get"in i?!r.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,o,i)}:function(e,r,t,o){void 0===o&&(o=t),e[o]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./mediainfo"),exports),__exportStar(require("./mediainfo.types"),exports),__exportStar(require("./mp4box"),exports),__exportStar(require("./mp4box.types"),exports),__exportStar(require("./resolution"),exports),__exportStar(require("./resolution.types"),exports),__exportStar(require("./m3u8"),exports),__exportStar(require("./m3u8.types"),exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soga/mediainfo",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -44,6 +44,7 @@
44
44
  "license": "ISC",
45
45
  "dependencies": {
46
46
  "fs-extra": "^11.2.0",
47
+ "m3u8-parser": "^7.2.0",
47
48
  "mediainfo.js": "^0.3.4",
48
49
  "mp4box": "^0.5.3"
49
50
  }