Skip to content

Commit 7c3e9d0

Browse files
authored
Prepare for RC1
* Moved README to markdown * Changed distribution directory to /dist * Added unpkg directory to package.json * Moved version to rc.1
1 parent 9d230fb commit 7c3e9d0

File tree

6 files changed

+176
-210
lines changed

6 files changed

+176
-210
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build/
2+
dist/
23
node_modules/
34
nbproject/private
45
ga.js

Gruntfile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ module.exports = function (grunt) {
109109

110110
grunt.registerTask('build:debug', ['jshint', 'browserify', 'exec:minify', 'sync:all', 'sync:debug', 'npmcopy']);
111111

112+
grunt.registerTask('build', ['build:debug']);
113+
112114
grunt.registerTask('clean', ['clean']);
113115

114116
};

README.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
_ _ _____
2+
(_) | | / ____|
3+
_ _ __ ___ ___ ___ | | | (___
4+
| | | '_ ` _ \ / __| / __| _ | | \___ \
5+
| | | | | | | | \__ \ | (__ | |__| | ____) |
6+
|_| |_| |_| |_| |___/ \___| \____/ |_____/
7+
8+
9+
10+
INTRODUCTION
11+
============
12+
13+
imscJS is a JavaScript library for rendering [IMSC 1.0.1](https://www.w3.org/TR/ttml-imsc1.0.1/) and [IMSC 1.1](https://www.w3.org/TR/ttml-imsc1.1/) documents to HTML5. IMSC is a profile of [TTML 2](https://www.w3.org/TR/ttml2/) designed for subtitle and caption delivery worldwide.
14+
15+
imscJS 1.1.x implements [IMSC 1.0.1](https://www.w3.org/TR/ttml-imsc1.0.1/) and [IMSC 1.1](https://www.w3.org/TR/ttml-imsc1.1/), and is recommended for routine use.
16+
17+
imscJS 1.0.x only implements [IMSC 1.0.1](https://www.w3.org/TR/ttml-imsc1.0.1/), and is no longer being actively developed.
18+
19+
A sample web app that uses imscJS is available at http://sandflow.com/imsc1_1/index.html.
20+
21+
Documentation is available on [MDN](https://developer.mozilla.org/en-US/docs/Related/IMSC).
22+
23+
24+
25+
KNOWN ISSUES AND LIMITATIONS
26+
============================
27+
28+
imscJS is primarily developed on Firefox. Latest versions of Chrome, Safari, and Microsoft Edge are intended to be supported nevertheless, albeit with potentially reduced capabilities. In particular, advanced ruby layout is currently only supported by Firefox.
29+
30+
imscJS is intended to reflect the most recent published versions of [IMSC 1.0.1](https://www.w3.org/TR/ttml-imsc1.0.1/) and [IMSC 1.1](https://www.w3.org/TR/ttml-imsc1.1/). These publications are routinely clarified by proposed resolutions to issues captured in their respective bug trackers.
31+
32+
imscJS bugs are tracked at https://github.com/sandflow/imscJS/issues.
33+
34+
35+
36+
RUNTIME DEPENDENCIES
37+
====================
38+
39+
(required) [sax-js 1.2.1](https://www.npmjs.com/package/sax)
40+
41+
Rendering to HTML5 requires a browser environment, but parsing an IMSC1 document and tranforming it into ISDs does not.
42+
43+
44+
45+
DEVELOPMENT DEPENDENCIES
46+
========================
47+
48+
(required) node.js (see [package.json](package.json) for a complete list of dependencies)
49+
50+
(recommended) git
51+
52+
53+
54+
QUICK START
55+
===========
56+
57+
* run the `build` target defined in [Gruntfile.js](Gruntfile.js) using [grunt](http://gruntjs.com/).
58+
59+
* 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:
60+
61+
```html
62+
<script src="libs/sax.js"></script>
63+
<script src="libs/imsc.js"></script>
64+
```
65+
66+
See BUILD ARTIFACTS for a full list of build artifacts, and TESTS AND SAMPLES for a list of samples and tests available.
67+
68+
69+
70+
ARCHITECTURE
71+
============
72+
73+
API
74+
---
75+
76+
imscJS renders an IMSC1 document in three distinct steps:
77+
78+
* `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.
79+
80+
* `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[`.
81+
82+
* `renderHTML(isd, element, imgResolver, eheight, ewidth, displayForcedOnlyMode, errorHandler, previousISDState, enableRollUp)` renders an `isd` object returned by `generateISD()` into a newly-created `div` element that is appended to the `element`. The `element` must be attached to the DOM. The height and width of the child `div` element are equal to `eheight` and `ewidth` if not null, or `clientWidth` and `clientHeight` of the parent `element` otherwise. Images URIs specified in `smpte:background` attributes are mapped to image resource URLs by the `imgResolver` function. The latter takes the value of the `smpte:background` attribute URI and an `img` DOM element as input and is expected to set the `src` attribute of the `img` DOM element to the absolute URI of the image. `displayForcedOnlyMode` sets the (boolean) value of the IMSC1 displayForcedOnlyMode parameter. `enableRollUp` enables roll-up as specified in CEA 708. `previousISDState` maintains states across calls, e.g. for roll-up processing.
83+
84+
In each step, the caller can provide an `errorHandler` to be notified of events during processing. The `errorHandler` may define four methods: `info`, `warn`, `error` and `fatal`. Each is called with a string argument describing the event, and will cause processing to terminate if it returns `true`.
85+
86+
Inline documentation provides additional information.
87+
88+
89+
MODULES
90+
-------
91+
92+
imscJS consists of the following modules, which can be used in a node
93+
environment using the `require` functionality, or standalone, in which case each module hosts its
94+
definitions under a global name (the token between parantheses):
95+
96+
* `doc.js` (`imscDoc`): parses an IMSC1 document into an in-memory TT object
97+
* `isd.js` (`imscISD`): generates an ISD object from a TT object
98+
* `html.js` (`imscHTML`): generates an HTML fragment from an ISD object
99+
* `names.js` (`imscNames`): common constants
100+
* `styles.js` (`imscStyles`): defines TTML styling attributes processing
101+
* `utils.js` (`imscUtils`): common utility functions
102+
103+
104+
105+
BUILD
106+
=====
107+
108+
imscJS is built using the `build:release` or `build:debug` Grunt tasks -- the `build` task is an alias of `build:debug`.
109+
110+
The `dist` directory contains the following build artifacts:
111+
* `imsc.all.debug.js`: Non-minified build that includes the sax-js dependency.
112+
* `imsc.all.min.js`: Minified build that includes the sax-js dependency.
113+
* `imsc.debug.js`: Non-minified build that does not include the sax-js dependency.
114+
* `imsc.min.js`: Minified build that does not include the sax-js dependency.
115+
116+
The `build/public_html/libs/imsc.js` files is identical to:
117+
* `imsc.debug.js`, if the `build:debug` task is executed.
118+
* `imsc.min.js`, if the `build:release` task is executed.
119+
120+
121+
122+
RELEASES
123+
========
124+
125+
imscJS is released as an NPM package under [imsc](https://www.npmjs.com/package/imsc). The `dev` distribution tag indicates pre-releases.
126+
127+
All builds are available on the [unpkg](https://unpkg.com/) CDN under the `dist` directory.
128+
129+
EXAMPLE: https://unpkg.com/[email protected]/dist/
130+
131+
132+
133+
TESTS AND SAMPLES
134+
=================
135+
136+
137+
W3C Test Suite
138+
--------------
139+
140+
imscJS imports the [IMSC1 test suite](https://github.com/w3c/imsc-tests) as a submodule at `src/test/resources/imsc-tests`. The gen-renders.html web app can be used to generate PNG renderings as as well intermediary files from these tests.
141+
142+
143+
Unit tests
144+
----------
145+
146+
Unit tests run using [QUnit](https://qunitjs.com/) are split between:
147+
148+
* [src/test/webapp/js/unit-tests.js](src/test/webapp/js/unit-tests.js)
149+
* [src/test/js](src/test/js)
150+
151+
152+
NOTABLE DIRECTORIES AND FILES
153+
=============================
154+
155+
* [package.json](package.json): NPM package definition
156+
157+
* [Gruntfile.js](Gruntfile.js): Grunt build script
158+
159+
* [properties.json](properties.json): General project properties
160+
161+
* [LICENSE](LICENSE): License under which imscJS is made available
162+
163+
* [src/main/js](src/main/js): JavaScript modules
164+
165+
* [src/test](src/test): Test files
166+
167+
* [dist](dist): Built libraries
168+
169+
* [build/public_html](uild/public_html): Test web applications

README.txt

Lines changed: 0 additions & 207 deletions
This file was deleted.

0 commit comments

Comments
 (0)