<!DOCTYPE html>
<html>
<head>
- <title>Popcorn 0.1 parser Plug-in Demo</title>
+ <title>Popcorn 0.3 TTXT parser Plug-in Demo</title>
<script src="../../popcorn.js"></script>
- <script src="../../test/jquery.js"></script>
<script src="../../plugins/subtitle/popcorn.subtitle.js"></script>
<script src="popcorn.parseTTXT.js"></script>
</head>
<body>
- <h1 id="qunit-header">Popcorn 0.1 parser Plug-in Demo</h1>
- <p></p>
+ <h1 id="qunit-header">Popcorn 0.3 TTXT parser Plug-in Demo</h1>
+ <p>Subtitles are processed from <a href="data/data.TTXT">here</a></p>
<div>
<video id='video' data-timeline-sources="data/data.TTXT"
controls
</video>
</div>
-
- <div id="flickrdiv"></div>
</body>
</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn 0.3 TTXT parser Plug-in Test</title>
+ <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
+ <script src="../../test/qunit/qunit.js"></script>
+ <!--
+ do not move - this must be called immediately prior to
+ popcorn-api-draft.js
+ -->
+
+ <script src="../../popcorn.js"></script>
+
+ <script src="popcorn.parseTTXT.js"></script>
+ <script src="../../plugins/subtitle/popcorn.subtitle.js"></script>
+ <script src="popcorn.parseTTXT.unit.js"></script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn 0.3 TTXT parser Plug-in Test</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"> </div>
+
+ <video id='video'
+ controls
+ width= '250px'
+ poster="../../test/poster.png">
+
+ <source id='mp4'
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id='ogv'
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+</body>
+</html>
--- /dev/null
+test("Popcorn 0.3 TTXT Parser Plugin", function () {
+
+ var expects = 8,
+ count = 0,
+ key,
+ numSubs = 0,
+ poppercorn = Popcorn( "#video" ),
+ subs = { // Expected values
+ "0": "",
+ "3": "[Background Music Playing]",
+ "6": "",
+ "16": "Heay!!",
+ "18": "",
+ "26": "[Bird noises]",
+ "31": ""
+ }
+ };
+
+ function plus() {
+ if ( ++count === expects ) {
+ start();
+ }
+ }
+
+ poppercorn.parseTTXT("data/data.ttxt");
+
+ expect(expects);
+
+ stop( 10000 );
+
+ // Allow load time
+ setTimeout(function () {
+ Popcorn.forEach(poppercorn.getTrackEvents(), function(evt) {
+ if(evt._natives.type === "subtitle") {
+ numSubs++;
+ key = Math.ceil(evt.start).toString();
+ equals(subs[key], evt.text , "Correct amounts" );
+ plus();
+ }
+ });
+
+ equals(7, numSubs , "Correctly parsed all subs" );
+ plus();
+
+ }, 1500);
+
+});