Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inspector-js v2.0 #17

Open
wants to merge 199 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
849b5c0
mp4 track: more fixes to properly support multi trun + extract correc…
tchakabam Jun 2, 2018
e9b48b8
mp4 demux: read truns only when we have resolved data offset fully
tchakabam Jun 2, 2018
78c9362
frame: add unflagged type
tchakabam Jun 4, 2018
577181a
frame: init bytesOffset with NaN
tchakabam Jun 4, 2018
97faae8
frame: getDurationInSeconds()
tchakabam Jun 4, 2018
5000d6b
mdat: don't continue to try and read what doesn't seem to be NAL units
tchakabam Jun 4, 2018
2cbbd61
trun: make parseFlags public
tchakabam Jun 4, 2018
eefee00
trun: more clear members
tchakabam Jun 4, 2018
2037c70
mp4-track: parse default sample flags correctly and use as fallback
tchakabam Jun 4, 2018
dcf3502
mp4-demuxer: when creating track, accept not knowing sample data offset
tchakabam Jun 4, 2018
37ba109
break out main.js + styles from samples index
tchakabam Jun 4, 2018
0a4e2d1
add editorconfig files
tchakabam Jun 4, 2018
1179167
webpack: publicPath should be /
tchakabam Jun 4, 2018
82f3369
samples index: Improve UI
tchakabam Jun 4, 2018
8c22289
proper lint script in package
tchakabam Jun 4, 2018
ed431e8
add package-lock file
tchakabam Jun 1, 2018
31d9098
track: add type-checking methods
tchakabam Jun 15, 2018
71d5d1f
mp4-track: add method to get relavant audio/video-atom and resolution
tchakabam Jun 15, 2018
6f3cd3c
mp4-demuxer: streamline parsing flow (create tracks once all metadata…
tchakabam Jun 15, 2018
d8605b6
add data property to avcC
tchakabam Jun 16, 2018
ae89deb
export TSTrack
tchakabam Jul 26, 2018
af654b2
avcC: unused import
tchakabam Jul 26, 2018
95186df
ts demuxer: use TSTrack class
tchakabam Jul 26, 2018
8eaa974
ts demuxer: add RAW_MPEG_AUDIO
tchakabam Jul 26, 2018
1af02d0
ts demuxer: add comment
tchakabam Jul 26, 2018
9b21e3c
ts demuxer: use const insted of let
tchakabam Jul 26, 2018
ea1053e
bit-reader: fix syntax
tchakabam Jul 26, 2018
8f5ddfd
mp4-track: progress on plain MOV support
tchakabam Oct 18, 2018
3e7dd80
add ctts and stss boxes
tchakabam Oct 18, 2018
dd7fc17
add logger module
tchakabam Oct 18, 2018
48dd5a1
add support for sample-table (mov) parsing (as opposed to moof/trun) …
tchakabam Oct 18, 2018
18025bf
mp4 demuxer logs and cosmetics
tchakabam Oct 18, 2018
7f0d0ec
support processing sample table
tchakabam Oct 18, 2018
f40d517
digest sample tables
tchakabam Oct 18, 2018
89080d6
add timescale util functions
tchakabam Oct 18, 2018
806e64b
support for mov demuxing (samples tables)
tchakabam Oct 30, 2018
82b40d4
fix demuxing fmp4 (now both mov + fmp4 work)
tchakabam Oct 30, 2018
931f727
remove unused comment
tchakabam Oct 30, 2018
4ef2062
use esds as track reference atom and extract ES descriptor data conta…
tchakabam Nov 14, 2018
4b347eb
enable unscaled integer sample timing values for mp4
tchakabam Nov 14, 2018
1feec29
rename frame properties to unscaled..
tchakabam Nov 29, 2018
0725c52
move mp4 sample flags parse function to mp4 subtree
tchakabam Jul 10, 2019
b34ef54
add PPS parsing support
tchakabam Jul 10, 2019
f33c483
h264 parsing utils cosmetics
tchakabam Jul 10, 2019
3dab785
mp4 demuxer: support for fragmented mode without sidx box to find tim…
tchakabam Jul 10, 2019
ad27c7c
Merge branch 'mmjs/dev'
tchakabam Jul 10, 2019
673ba49
rename sps-parser to param-set-parser
tchakabam Jul 10, 2019
30f14a4
mp4 demuxer: support for fragmented mode without sidx box to find tim…
tchakabam Jul 10, 2019
d04c4b0
mp4-sample-table: loglevel default off
tchakabam Jan 14, 2019
4c0bca3
sps parser fixes
tchakabam Feb 26, 2019
a389325
mp4 sample table: fix corner cases of ctts decompression.
tchakabam Mar 14, 2019
b2a5cf1
mp4 sample table decompression: handle all cases of chunk-to-sample s…
tchakabam Mar 19, 2019
37ea758
fix merge conflict
tchakabam Jul 10, 2019
22e9a1f
add level and profile idc values to SPS object
tchakabam Jul 10, 2019
9b7e6a9
mp4 demux: allow to parse multiple track codec description reference …
tchakabam Jul 10, 2019
a401c48
h264: rename class to H264ParamSetParser
tchakabam Jul 24, 2019
240c28d
use renamed param set parset in avcc parser and h264 bitstream reader
tchakabam Jul 24, 2019
37fdc54
mp4 demuxer: fix missing break statement in switch-case
tchakabam Jul 24, 2019
770651c
mdat atom: disable broken payload parsing and add data property for e…
tchakabam Aug 5, 2019
1517330
mvhd atom: fix offsets on parsing version 1 box containing 64-bit fields
tchakabam Aug 8, 2019
52ff61a
rename function parseLong64 to parseUint64
tchakabam Aug 8, 2019
cff6cb0
mp4 box parser: properlly suppprot size=1 case
tchakabam Aug 8, 2019
14f4cc3
parseUint byte parser function: add optional integer overflow protection
tchakabam Aug 8, 2019
03c0d71
mp4 demuxer: fix for parsing MOV files containg track types we do not…
tchakabam Aug 23, 2019
7bfcc53
mp4 demuxer: disable logs
tchakabam Sep 12, 2019
b806098
rm console.log
tchakabam May 11, 2020
0f3e893
rm logger module
tchakabam Jun 30, 2020
500d6ef
replace log fns by noops
tchakabam Jun 30, 2020
d4245cb
binding log func properly
tchakabam Jun 30, 2020
d630369
more rm logger
tchakabam Jun 30, 2020
3dd3483
mp4 demuxer: code style fix on comment
tchakabam Oct 4, 2021
860df43
demuxer frame contructor assertion on size parameter
tchakabam Oct 4, 2021
36f65c5
mp4 track: fallback for frame size missing in sample entry to trak de…
tchakabam Oct 4, 2021
bb77284
mp4-demux/track: handle different tfhd default values for each trun (…
tchakabam Oct 6, 2021
f4d2e63
base track: add flush method impl and rm redundant init in constructor
tchakabam Oct 6, 2021
b8dae70
trun box: fix member init to be in declaration + fix dataOffset 0 init
tchakabam Oct 8, 2021
36e0d46
h264-reader: revert previous changes that were experimental/wip
tchakabam Nov 4, 2021
10ead85
rm native console log calls in mpeg-reader and webm demux
tchakabam Nov 4, 2021
f8106ec
ts-demuxer: append method called on empty internal buffer creates copy
tchakabam Nov 17, 2021
741b86f
ts-demux: append(): rename temp to newBuffer (the ref is not temp in …
tchakabam Nov 17, 2021
51f5ef7
ts-demuxer: in end() method, set dataOffset = 0, otherwise can crash
tchakabam Nov 17, 2021
78904fd
ts-demuxer: add onPmtParsed callback for consuming side to flush acco…
tchakabam Nov 17, 2021
d6834f0
ts-demuxer: readSamples: add check to fix crash occuring when flushin…
tchakabam Nov 17, 2021
84a50da
ts-demuxer: rename methods to parseProgramAllocationTable & parseProg…
tchakabam Nov 17, 2021
9840a91
ts-track: fix line break
tchakabam Nov 17, 2021
87ed3d4
h264-reader: add check on dataBuffer to fix crash occuring on flush c…
tchakabam Nov 17, 2021
94b8599
ts-track & payload-reader: add popFrames method to consume frames con…
tchakabam Nov 21, 2021
c382baf
ts-demux: add get currentBufferSize to check on current analyze buffe…
tchakabam Nov 21, 2021
3dcc408
ts-demux: optimize buffer shifting after parse code to be more explicit
tchakabam Nov 21, 2021
eda9b7a
h264-reader: improve code readability, rename local pts to timeUs (un…
tchakabam Nov 22, 2021
fe3afe4
pes-reader: rename private lastPts to lastPtsUs
tchakabam Nov 22, 2021
b86e532
ts-track: ensure to return non-null array on frame getters & shorten …
tchakabam Nov 22, 2021
bb20b0e
payload-reader: popFrames: optimize on empty frames state (dont do an…
tchakabam Nov 22, 2021
4fdd78f
ts-demuxer: parsing logic refactor to support properly partial/unsegm…
tchakabam Nov 23, 2021
cc85f97
ts-demuxer: add getters currentPacketCount and isPmtParsed
tchakabam Nov 23, 2021
8e7f5e9
ts-demux: rename method to processTsPackets and internal locals
tchakabam Nov 23, 2021
be7fd70
ts-demuxer: spec append method to return parsing buffer pruned remain…
tchakabam Nov 23, 2021
8a868dd
ts-demuxer: fix check on data offset assertion in buffer pruning
tchakabam Nov 23, 2021
fc1ef6d
pes-reader: fix PTS/DTS header parsing, see comments, was failing > 3…
tchakabam Nov 23, 2021
17041e9
ts-demuxer: add prune method to expose pop`ing off data on demand fro…
tchakabam Nov 25, 2021
b81a910
Update h264-reader.ts
jeoliva Dec 22, 2021
92bf270
Merge pull request #2 from jeoliva/patch-1
tchakabam Dec 22, 2021
aa7b083
mp4-demux: handle base-media-decode-time properly + improve track int…
tchakabam Jan 6, 2022
ba78d7d
h264-reader: safely initialize sps/pps member props on construction
tchakabam Jan 10, 2022
220f452
h264-payload-reader: rm getNALUnitName (unused, can be done via enum …
tchakabam Jan 16, 2022
2c03d15
h264-reader/nal-units: centralize enums and mapping funcs
tchakabam Jan 16, 2022
8ff4003
h264-reader: slice-frame parse/mapping param typesafety fix
tchakabam Jan 16, 2022
2db6542
h264/nal-units: rename FRAME_TYPE.UNKNOWN to NONE
tchakabam Jan 28, 2022
c1201c4
frame base class: change frameType member to FRAME_TYPE + rm static v…
tchakabam Jan 28, 2022
1d204c6
mp4 & webm Frame constructor calls: replace arg by FRAME_TYPE enum usage
tchakabam Jan 28, 2022
c9867b0
payload-reader: rename abstract consumeData to read + rename in subcl…
tchakabam Jan 28, 2022
564528a
adts & h264 reader: use of novel onData callback to do demuxing
tchakabam Jan 28, 2022
bc2c8bf
timescale: add mpegClockTimeToMicroSecs
tchakabam Feb 9, 2022
d9c42fa
payload-reader: change flush param name to "time", as it can also be DTS
tchakabam Feb 9, 2022
c019611
pes-reader: add onPayloadReaderData handler for onData of payload-reader
tchakabam Feb 9, 2022
c124850
pes-reader: make readPesTimingInfo static
tchakabam Feb 9, 2022
6e6cc6b
bit-reader: rm destroy method, doesn't influece GC-ing behavior in an…
tchakabam Feb 9, 2022
502875c
h264-reader: optimize NALU subarray-ing (only once), modify parseSlic…
tchakabam Feb 9, 2022
b722abb
payload-reader: streamline append method logic (rm BitReader.remainin…
tchakabam Feb 9, 2022
d78b2aa
h264-reader: use nalu-buffer directly, avoid any redundant subarray u…
tchakabam Feb 9, 2022
5867eaf
nal-units: extend enum to all specified NAL_UNIT_TYPE values
tchakabam Feb 9, 2022
51578a3
pes-reader: rm unnecessary assertion of payloadReader init
tchakabam Feb 9, 2022
6eb41ae
h264-reader: streamline internal nalu-reading/parsing, rm readNaluHeadAt
tchakabam Feb 9, 2022
331e020
pes/payload-reader: add time & nalu-type args to onData callback
tchakabam Feb 10, 2022
3376722
payload-reader: add internal PUSI tracking (count and frame-list length)
tchakabam Mar 10, 2022
2a7f78e
ts-track: popFrames addd wholePayloadUnits flag propagated to payload…
tchakabam Mar 10, 2022
3259b78
utils: timescale: add MPEG_CLOCK_HZ const
tchakabam Mar 10, 2022
2deac3d
pes-reader: convert stream-types lookup to enum + fix type in constru…
tchakabam Mar 10, 2022
d8b72a5
ts-demuxer: use new MptsElementaryStreamType enum in PES-reader factory
tchakabam Mar 10, 2022
cdd0e84
ts-demuxer: init pmtId with Nan instead -1 & rename cb to onProgramMa…
tchakabam Apr 1, 2022
df3ce0c
pes/payload-reader: pass nalu-type in payload cb + add getPusiCount m…
tchakabam Apr 1, 2022
7b14ee3
h264-reader: rm Q comment
tchakabam Apr 24, 2022
f6edb5b
adts-reader: refactor parsing control flow (findNextSync return result)
tchakabam Apr 25, 2022
5e3ab0d
adts-reader: add generic error debugger around parseHeader call
tchakabam Apr 28, 2022
8daec96
adts parse err: rm hard debug log
tchakabam May 11, 2022
9c2aac4
payload-reader: fix reset() to null dataBuffer as well
tchakabam May 12, 2022
b431623
adts-reader reader: fix handling partial/broken payload in header par…
tchakabam May 12, 2022
6e1b3e0
adts-reader: fix init BitReader with full buffer instead non-crc head…
tchakabam May 12, 2022
308322e
adts-reader: flatten header-parser assertions ctrl-flow
tchakabam May 12, 2022
b11f4cd
adts-reader: add fixme related to parser semantic Frames vs AAC frame…
tchakabam May 12, 2022
255e510
adts-reader: add timing info to exception on read/parse call + impr g…
tchakabam May 14, 2022
8c4aa9c
ts-track: make getMetadata impl trivial (should be deprecated in supe…
tchakabam May 30, 2022
cda4b14
track: @deprecated getMetadata
tchakabam May 30, 2022
23494a8
adts-reader: intro AdtsFrameInfo iface and use for reader int state
tchakabam May 30, 2022
67986b7
adts-reader: fix in error message for parsing exception
tchakabam May 31, 2022
cc0d22c
adts-reader: add currentFrameInfo public getter + rm trivial constructor
tchakabam May 31, 2022
852b36e
pes-reader: fix using ms time in onPayloadData call args
tchakabam Jun 21, 2022
961c736
adts-reader: silently accept handling channelConf=0 case for now
tchakabam Jun 21, 2022
f98800f
demuxer: track/frame: refactor some basic concepts to allow scaled time
tchakabam Jun 29, 2022
76d366b
demuxer mpts: pes-reader cleanup payload-unit timing handling + add P…
tchakabam Jun 29, 2022
a654097
mpts payload unit parsers: generalize current-time concept and ease r…
tchakabam Jun 29, 2022
a0043a4
mp4: adapt with regard to prior refactoring of generic track model
tchakabam Jun 29, 2022
03c6ec8
webm-track: slight adaptations due to prior refactoring on track model
tchakabam Jun 29, 2022
173882b
frame: print values to assertion error messages
tchakabam Jul 5, 2022
34f1282
style fix
tchakabam Jul 5, 2022
df15faf
adts-reader: fix assertion check logic in header parsing
tchakabam Jul 5, 2022
14a92f1
payload readers: replace assertion by early return in read (see comment)
tchakabam Jul 5, 2022
ab701a7
ts-demuxer: disable deprecated method resetTracks (unused yet)
tchakabam Jul 5, 2022
bdb183c
track: add hasTimescale and add assertion sign cond for setTimescale …
tchakabam Jul 5, 2022
a9d21ad
mp4-track: add getDurationInSeconds convenience accessor (needs hasTi…
tchakabam Jul 5, 2022
fa37a9f
rm dead debug log
tchakabam Jul 5, 2022
032a4f8
ts-demuxer: fix bug in packet parsing subarray indexing offset
tchakabam Jul 8, 2022
d72dd59
h264-reader: read(): add length assertion on data buffer using ?. acc…
tchakabam Jul 8, 2022
0ed9aae
h264-reader: pass CTO in onData callback + rm readNaluData return end…
tchakabam Jul 8, 2022
6fbafcd
adts-reader improve comment
tchakabam Jul 8, 2022
b23adae
h264-reader: prefix private method names for better readability
tchakabam Jul 12, 2022
60ed91e
ts-demux: style fixup and remove dead parts
tchakabam Jul 27, 2022
be729f7
adts-reader: add dtsOffset to track timing of several frames within o…
tchakabam Aug 1, 2022
13aee76
mpeg-ts demux: use unsigned right shift to read adaptationField + add…
tchakabam Aug 3, 2022
49efd93
parsePesHeaderTimestamps: compute and return header remainder length …
tchakabam Aug 3, 2022
eab5a4a
adts-reader: use audio-samplerate accurate timing, support multiple f…
tchakabam Aug 3, 2022
620bac5
pes-reader: fix skipping PES header extension remainder after parsing…
tchakabam Aug 3, 2022
da92292
pes header parse: skip remainder inside parsePesHeader (renamed to ex…
tchakabam Aug 3, 2022
3dbfcc1
adts-reader: re-enable assertion on mpegVersion field and put sample-…
tchakabam Aug 3, 2022
adabc3c
pes-header optional fields parsing: add jsdocs and other comments and…
tchakabam Aug 3, 2022
9fc6552
pes-reader rename method to appendPacket, improve order of methods in…
tchakabam Aug 3, 2022
4570519
adts-reader: remove ignoring channel-conf assertion failed (re-enable…
tchakabam Aug 3, 2022
5fe5c86
refactor track type to number-based enum (propagate change in all con…
tchakabam Aug 4, 2022
d737ad6
adts-reader fix buffer fill check prior header parsing to safely supp…
tchakabam Aug 4, 2022
cbe4d6a
adts-reader: fix comment
tchakabam Aug 4, 2022
f64b87c
pes-reader: refactor constructor stream-type handling by switch-case …
tchakabam Aug 5, 2022
331a5b1
rm blanks
tchakabam Aug 18, 2022
90104be
mpts demux: remove all concepts around update-track, it seems the fra…
tchakabam Aug 18, 2022
aa8fc0e
track model: make frames property abstract readonly to be implemented…
tchakabam Aug 20, 2022
4c5cc5e
mpts generic payload reader: fix bug in popFrames where instead reset…
tchakabam Aug 20, 2022
8d7a9ef
mpts payload reader: add better explanations around popFrames logic a…
tchakabam Aug 20, 2022
44c8461
adts-reader: add compile-time const ADTS_HEADER_ASSERT_MPEG_VERSION w…
tchakabam Sep 5, 2022
72b49b9
pes-reader: add _timeWrapOver32BitMp4Range option. computes mod over …
tchakabam Sep 7, 2022
3d037c0
mpts demuxer: add public r/w prop enableWrapOver32BitClock. current v…
tchakabam Sep 7, 2022
88f4664
pes-reader: simplify clock wrapping to only be done on DTS since for …
tchakabam Sep 8, 2022
781b3de
ts-demux: removed default value for PESReader constructor
tchakabam Sep 8, 2022
4e48f49
ts-track: add toJSON overload impl for debugging purpose (mostly to a…
tchakabam Sep 8, 2022
09593d4
ts-track fix toJSON to return object not string (this is how JSON.str…
tchakabam Sep 8, 2022
36227fa
timescale: rm toSecondsFromMicros & mpegClockTimeToMicroSecs (not nee…
tchakabam Sep 13, 2022
ec3f648
pes-reader: add pre-assertion on CTO computation result < 0; throw er…
tchakabam Sep 13, 2022
a60b7ce
pes-header PTS/DTS clock parsing: fix 2 bugs in value expansion logic…
tchakabam Sep 13, 2022
466052f
frame: rm unused import toSecondsFromMicros + add mpegClockTimeToSecs…
tchakabam Sep 13, 2022
b9ac0e2
mpeg-ts-demuxer: make internal tracks hash properly private, add pub …
tchakabam Sep 14, 2022
549dfe2
mpts demux: refactor and fix issues in PSI table data parsing: suppor…
tchakabam Sep 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
root = true

[*]
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.yml]
indent_size = 2

[*.json]
indent_size = 2

[*.html]
indent_size = 2

[*.css]
indent_size = 2

[.*]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"build:prod": "cross-env NODE_ENV=production webpack --config ./webpack.config.js --progress --profile --color --display-error-details --display-cached --bail",
"clean": "npm cache clear && rimraf -- dist",
"test": "npm run build:dev && mocha --compilers js:babel-core/register --colors ./test/*.spec.js",
"test:watch": "mocha --compilers js:babel-core/register --colors -w ./test/*.spec.js"
"test:watch": "mocha --compilers js:babel-core/register --colors -w ./test/*.spec.js",
"lint": "tslint --project ."
},
"author": "[email protected]",
"license": "ISC",
Expand All @@ -39,7 +40,6 @@
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"tslint": "^5.1.0",
"tslint-loader": "^3.5.2",
"typescript": "^2.2.2",
"webpack": "^2.4.1",
"webpack-build-notifier": "^0.1.14",
Expand Down
2 changes: 2 additions & 0 deletions samples/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.js]
indent_size = 2
215 changes: 40 additions & 175 deletions samples/index.html
Original file line number Diff line number Diff line change
@@ -1,214 +1,79 @@
<!DOCTYPE html>
<html ng-app="myApp">
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
<%= htmlWebpackPlugin.options.title %>
Inspector.js - media file viewer and analyzer
</title>
<meta name="description" content="<%= htmlWebpackPlugin.options.title %>">
<style>
body {
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif
}
<meta name="description" content="Inspector.js - media file viewer and analyzer">

#atoms-info {
margin-top: 20px;
background-color: #94bf1e;
color: #ffffff;
border: 1px solid black;
display: flex;
}

.atom_column {
flex: 50%;
}

#atoms li {
cursor: pointer;
}

#details {
background-color: #000000;
}

#tracks {
margin-top: 20px;
}
</style>
<link rel="stylesheet" href="/samples/style.css">
</head>

<body>
<h3>Basic sample</h3>
<h3>Inspector.js - media file viewer and analyzer</h3>
<div>
Sample media assets:
<select id="mediaUrl">
<option value="https://video-dev.github.io/streams/x36xhzz/url_0/url_462/193039199_mp4_h264_aac_hd_7.ts">TS Segment</option>
<option value="http://multiplatform-f.akamaihd.net/i/multi/will/bunny/big_buck_bunny_,640x360_400,640x360_700,640x360_1000,950x540_1500,.f4v.csmil/segment2_0_av.ts">Another TS Segment</option>
<option value="https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps_480x270_600k/bbb_30fps_480x270_600k_0.m4v">MP4 Init Segment</option>
<option value="https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps_480x270_600k/bbb_30fps_480x270_600k_1.m4v">MP4 Segment</option>
<option value="https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/v-0480p-1000k-libx264.mp4">Fragmented MP4 video file (multi-segment)</option>
<option value="https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/a-eng-0128k-aac.mp4">Fragmented MP4 audio file (multi-segment)</option>
<option value="https://media.axprod.net/TestVectors/v7-Clear/8/init.mp4">MP4 Init Segment H265</option>
<option value="https://media.axprod.net/TestVectors/v7-Clear/8/0001.m4s">MP4 Segment H265</option>
<option value="http://well-to-do-view.surge.sh/big-buck-bunny_trailer.webm">WebM file</option>
<option value="https://storage.googleapis.com/shaka-demo-assets/sintel-webm-only/v-0240p-0300k-vp9.webm">WebM video segment of DASH stream</option>
<option value="https://storage.googleapis.com/shaka-demo-assets/sintel-webm-only/a-eng-0128k-libopus.webm">WebM audio segment of DASH stream</option>
</select>
<input type="button" value="Inspect" onclick="inspectMedia()">
<input type="button" value="Inspect selected sample" onclick="inspectMedia('remote-sample-media')">
</div>

<div id="atoms-info">
<div id="atoms" class="atom_column">
</div>
<div id="details" class="atom_column">
</div>
</div>

<div id="tracks"></div>

<script>
function inspectMedia() {
clearTracksInfo();
clearAtomsTree();
clearAtomDetails();

var mediaUrl = document.getElementById("mediaUrl").value;
if (!mediaUrl) return;

var req = new XMLHttpRequest();
req.open('GET', mediaUrl, true);
req.responseType = 'arraybuffer';

req.onload = function (data) {
var arrayBuffer = req.response;
if (arrayBuffer) {
var byteArray = new Uint8Array(arrayBuffer);

var demuxer = createDemuxer(mediaUrl);
demuxer.append(byteArray);
demuxer.end();

updateAtomsInfo(demuxer);
updateTracksInfo(demuxer);
}
};

req.send(null);
}

function createDemuxer(mediaUrl) {
// Find out demuxer looking at file extension. "Enough" good for this sample
var ext = mediaUrl.split('.').pop();
if (ext === 'ts') {
return inspectorjs.createMpegTSDemuxer();
} else if (ext === 'webm') {
return inspectorjs.createWebMDemuxer();
} else {
return inspectorjs.createMp4Demuxer();
}
}

function updateTracksInfo(demuxer) {
var el = document.getElementById('tracks');
for (var trackId in demuxer.tracks) {
addTrackInfo(el, demuxer.tracks[trackId]);
}
}

function addTrackInfo(el, track) {
var trackEl = document.createElement('div');
<br>

// Add track general info
trackEl.innerHTML = '<h4>Track # ' + track.id + ' - ' + track.mimeType + '</h4>';

// Add frame details
var framesEl = document.createElement('ul');
for (var frame of track.frames) {
var frameEl = document.createElement('li');
frameEl.innerHTML = 'Frame ' + frame.frameType + ' - ' + parseFloat(frame.timeUs / 1000000).toFixed(3);
framesEl.appendChild(frameEl);
}
trackEl.appendChild(framesEl);

// Add track info to dom
el.appendChild(trackEl);
}

function updateAtomsInfo(demuxer) {
// Only makes sense for MP4 files
if (demuxer.atoms) {
var el = document.getElementById('atoms');
addAtoms(el, demuxer.atoms);
}
}

// Add information about MP4 atoms
function addAtoms(parent, atoms) {
if (!atoms || atoms.length === 0) return;

var containerEl = document.createElement('ul');
for (var atom of atoms) {
var atomEl = document.createElement('li');
atomEl.innerHTML = atom.type + ', ' + atom.size + ' bytes';
atomEl.onclick = renderAtomDetails.bind(null, atom);
containerEl.appendChild(atomEl);

if (atom.atoms && atom.atoms.length > 0) {
addAtoms(atomEl, atom.atoms);
}
}

parent.appendChild(containerEl);
}
<div>
<input size="64" id="urlInput" type="input">
<input type="button" value="Inspect input URL" onclick="inspectMedia('remote-input-url')">
</div>

function renderAtomDetails(atom, event) {
event.stopPropagation();
var el = document.getElementById('details');
clearAtomDetails();
<br>

var containerEl = document.createElement('ul');
for (var p in atom) {
if (atom.hasOwnProperty(p) && shouldRenderAtom(p, atom)) {
var item = document.createElement('li');
item.innerHTML = p + ":" + atom[p];
containerEl.appendChild(item);
}
}
<div>
<input id="fileInput" type="file">
<input type="button" value="Inspect local file" onclick="inspectMedia('local')">
</div>

el.appendChild(containerEl);
}
<br>

function clearTracksInfo() {
var el = document.getElementById('tracks');
<div>
<b>Total bytes:</b> <output id="totalBytes"></output>
<br>
<progress style="width:100%" id="loadProgress" min="0" max="100" value="0"></progress>
</div>

// Remove any child of tracks element
while (el.firstChild) {
el.removeChild(el.firstChild);
}
}
<br>

function clearAtomsTree() {
var el = document.getElementById('atoms');
<div>
<b>File URI:</b> <output style="width:100%" id="uri"></output>
</div>

// Remove any child of tracks element
while (el.firstChild) {
el.removeChild(el.firstChild);
}
}
<div id="viewer">
<div id="atoms-info">
<div id="atoms" class="atom_column">
</div>
<div id="details" class="atom_column">
</div>
</div>

function clearAtomDetails() {
var el = document.getElementById('details');
while (el.firstChild) {
el.removeChild(el.firstChild);
}
}
<div id="tracks"></div>
</div>

function shouldRenderAtom(p, atom) {
return p !== 'atoms' && p !== 'containerDataOffset' && p !== 'constructor';
//&& !Array.isArray(atom[p]);
}
</script>
<script src="/samples/main.js"></script>
<script src="inspectorjs-lib.js"></script>
</body>

</html>
</html>
Loading