Skip to content
Merged
Changes from all commits
Commits
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
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ imscJS bugs are tracked at https://github.com/sandflow/imscJS/issues.
RUNTIME DEPENDENCIES
====================

(required) [sax-js 1.2.1](https://www.npmjs.com/package/sax)
imscJS requires an XML parser. By default it uses the browser's native [`DOMParser`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser), so no additional library is needed in a browser environment. In environments where `DOMParser` is not available, e.g. Node.js, the caller must provide `fromXML()` with a parser that implements the contract defined in [src/main/js/parser.js](src/main/js/parser.js), e.g. [sax-js](https://www.npmjs.com/package/sax).

Rendering to HTML5 requires a browser environment, but parsing an IMSC document and transforming it into ISDs does not.

Expand All @@ -52,10 +52,9 @@ QUICK START

* run the `build` target defined in [Gruntfile.cjs](./Gruntfile.cjs) using [grunt](http://gruntjs.com/).

* the resulting `imsc.js` and `sax.js` files at `build/public_html/libs` are, respectively, the imscJS library and its sax-js dependency. For example, both libraries can be included in a web page as follows:
* the resulting `imsc.js` file at `build/public_html/libs` is the imscJS library. For example, it can be included in a web page as follows:

```html
<script src="libs/sax.js"></script>
<script src="libs/imsc.js"></script>
```

Expand All @@ -71,7 +70,7 @@ API

imscJS renders an IMSC document in three distinct steps:

* `fromXML(xmlstring, errorHandler, metadataHandler)` parses the document and returns a TT object. The latter contains opaque representation of the document and exposes the method `getMediaTimeEvents()` that returns a list of time offsets (in seconds) of the ISD, i.e. the points in time where the visual representation of the document change.
* `fromXML(xmlstring, errorHandler, metadataHandler, parser)` parses the document and returns a TT object. The latter contains opaque representation of the document and exposes the method `getMediaTimeEvents()` that returns a list of time offsets (in seconds) of the ISD, i.e. the points in time where the visual representation of the document change. The optional `parser` argument allows the caller to provide an alternative XML parser, e.g. in environments where the browser's native `DOMParser` is not available.

* `generateISD(tt, offset, errorHandler)` creates a canonical representation of the document (provided as a TT object generated by `fromXML()`) at a point in time (`offset` parameter). This point in time does not have to be one of the values returned by `getMediaTimeEvents()`. For example, given an ISOBMFF sample covering the interval `[a, b[`, `generateISD(tt, offset, errorHandler)` would be called first with `offset = a`, then in turn with offset set to each value of `getMediaTimeEvents()` that fall in the interval `]a, b[`.

Expand Down Expand Up @@ -104,12 +103,11 @@ BUILD
imscJS is built using the `build:release` or `build:debug` Grunt tasks -- the `build` task is an alias of `build:debug`.

The `dist` directory contains the following build artifacts:
* `imsc.all.debug.js`: Non-minified build that includes the sax-js dependency.
* `imsc.all.min.js`: Minified build that includes the sax-js dependency.
* `imsc.debug.js`: Non-minified build that does not include the sax-js dependency.
* `imsc.min.js`: Minified build that does not include the sax-js dependency.
* `imsc.debug.js`: Non-minified UMD build.
* `imsc.min.js`: Minified UMD build.
* `main/`: ES modules and TypeScript type declarations, used when the library is imported as an NPM package.

The `build/public_html/libs/imsc.js` files is identical to:
The `build/public_html/libs/imsc.js` file is identical to:
* `imsc.debug.js`, if the `build:debug` task is executed.
* `imsc.min.js`, if the `build:release` task is executed.

Expand Down
Loading