--- /dev/null
+1
+00:00:00,82 --> 00:00:03,09
+Hi, I am Po-Chiang (Bob), Po-Chiang Chao (Bob Chao)
+
+2
+00:00:03,14 --> 00:00:11,09
+I've participated in the project for about 6-7 years, starting from about 2002.
+
+3
+00:00:11,15 --> 00:00:17,17
+At first I started off translating technical documents and promoting web standards.
+
+4
+00:00:17,17 --> 00:00:21,90
+Since I am a web designer myself, I find it troublesome to have many different standards.
+
+5
+00:00:21,90 --> 00:00:24,61
+That's why I wanted to promote web standards.
+
+6
+00:00:24,78 --> 00:00:36,72
+The locale owner from two terms before, Lin Hong-De (piaip), invited me to help set up the moztw website, so I helped him.
+
+7
+00:00:36,72 --> 00:00:40,91
+After he entered the military service, I took over most of the works. Kind of like a lackey.
+
+8
+00:00:40,99 --> 00:00:47,64
+Up to now, the locale owner keeps changing, but I'm still helping out.
+
+9
+00:00:47,71 --> 99:59:59,00
+Mainly with marketing and promotion, and mostly to do with coordinating the community.
--- /dev/null
+1
+00:00:02,400 --> 00:00:05,200
+[Background Music Playing]
+
+2
+00:00:15,712 --> 00:00:17,399
+Heay!!
+
+3
+00:00:25,712 --> 00:00:30,399
+[Bird noises]
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn 0.3 SRT parser Plug-in Demo</title>
+
+ <script src="../../popcorn.js"></script>
+ <script src="../../plugins/subtitle/popcorn.subtitle.js"></script>
+ <script src="../../parsers/parserSRT/popcorn.parserSRT.js"></script>
+
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn 0.3 SRT parser Plug-in Demo</h1>
+ <p></p>
+ <div>
+ <video id='video' data-timeline-sources="data/data.srt"
+ 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>
+ </div>
+
+ <style>
+ .displays {
+ width: 300px;
+ height: 300px;
+ }
+ </style>
+
+</body>
+</html>
--- /dev/null
+// PARSER: 0.3 SRT
+
+(function (Popcorn) {
+ Popcorn.parser( "parseSRT", "SRT", function( data ) {
+
+ // declare needed variables
+ var retObj = {
+ title: "",
+ remote: "",
+ data: []
+ },
+ subs = [];
+
+ var toSeconds = function(t_in) {
+ var t = t_in.split(':');
+ var time = 0;
+
+ try {
+ var s = t[2].split(',');
+
+ time += parseFloat(t[0], 10)*60*60; // hours => seconds
+ time += parseFloat(t[1], 10)*60; // minutes => seconds
+ time += parseFloat(s[0], 10);
+ time += parseFloat(s[1], 10)/1000;
+ } catch (e) { time = 0; }
+
+ return time;
+ };
+
+ var createTrack = function( name, attributes ) {
+ var track = {};
+ track[name] = attributes;
+ return track;
+ };
+
+ var lines = data.text.replace("\r",'').split("\n");
+
+ for(var i=0, l=lines.length; i<l;i++) {
+ var sub = {};
+
+ i++; // Bypass idx
+ var time = lines[i++].split(" --> ");
+ var text = "";
+
+ sub.start = toSeconds(time[0]);
+ sub.end = toSeconds(time[1]);
+
+ while (lines[i] && lines[i] !== "\r") {
+ text += lines[i++].replace("\r", "");
+ }
+
+ sub.text = text;
+
+ subs.push( createTrack("subtitle", sub) );
+ }
+
+ retObj.data = subs;
+
+ return retObj;
+ });
+
+})( Popcorn );
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn 0.3 SRT 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="../../plugins/subtitle/popcorn.subtitle.js"></script>
+ <script src="popcorn.parseSRT.js"></script>
+
+ <script src="popcorn.parseSRT.unit.js"></script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn 0.3 SRT 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>
\ No newline at end of file
--- /dev/null
+test("Popcorn 0.3 SRT Parser Plugin", function () {
+
+ var expects = 4,
+ count = 0,
+ key,
+ numSubs = 0,
+ poppercorn = Popcorn( "#video" ),
+ subs = { // Expected values
+ "2.4": "[Background Music Playing]",
+ "15.712": "Heay!!",
+ "25.712": "[Bird noises]"
+ };
+
+ function plus() {
+ if ( ++count === expects ) {
+ start();
+ }
+ }
+
+ poppercorn.parseSRT("data/unit.srt");
+
+ expect(expects);
+
+ stop( 10000 );
+
+ alert("HI");
+ // 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(3, numSubs , "Correctly parsed all subs" );
+ plus();
+
+ }, 500);
+
+});
\ No newline at end of file