Monday, December 26, 2011

0.4 release

First is I change the createDefaultContain to access by closure, but i'm not sure does this achieve what cadecairos wants -- https://webmademovies.lighthouseapp.com/projects/63272/tickets/873-stop-subtitle-from-polluting-popcorn-instances

and I remove timeline.css as cadecairos said
https://webmademovies.lighthouseapp.com/projects/63272/tickets/879-remove-popcorntimelinecss

here is the commit url
https://github.com/keyanr/popcorn-js/commit/1eed62d0b2a80a568cf4f7ba2ccd35ede34dd8d8
Just ignore some crap testing code....:)

Wednesday, December 7, 2011

Late 0.3 Release

I add a popup feature for popcorn in my 0.3
This popup allow user to watch the video in a new popup window, and the original window's player will be paused and hiden while the popup window is existing.
If the user close the popup window, he/she can restore the original one by click the restore button. (In my origin plan, This should be done automatically, but the onunload method cannot be called correctly)
For now, this feature cannot store user's watching time point, so user has to start from begining, I'm looking for a way to achive that.

https://github.com/keyanr/popcorn-js/commit/2b7379d08212ab4ef134ad7946fb55d6832a6c5e

Sunday, December 4, 2011

Saturday, December 3, 2011

There are some problem in git push

When I try to push my test, this error message always appears.
So I will post my test here first.


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
-->
<head>
    <title>Test for Bug 633602</title>
    <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
    <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">Mozilla Bug 633602</a>
<div id="content">
</div>
    <pre id="test">
        <script type="application/javascript">

            /** Test for Bug 633602 **/
            SimpleTest.waitForExplicitFinish()

            SimpleTest.waitForFocus(function () {

                SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
                var pointer = navigator.pointer;
                var ePrevious = document.createEvent("MouseEvent");
                var eNow = document.createEvent("MouseEvent");
                var ep = document.createEvent("MouseEvent");
                var i = false;
                var t = 0;

                ePrevious.initMouseEvent("mousemove", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
                eNow.initMouseEvent("mousemove", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
                document.body.addEventListener("mousemove", function (e) {

                if (t <= 3) {
                    //check if mouseEvent contains movementX/Y
                ok(e.movementX != null, "MouseEvent must contain movementX.");
                ok(e.movementY != null, "MouseEvent must contain movementY.");


                eNow = e;
                ePrevious = ep;
                ep = e;

                if (i) {    //the validation won't start at the first time

                //check if movementX/Y = eNow.screenX/Y - ePrevious.screenX/Y
                if (pointer.islocked() == true || pointer.islocked() == false) {  //movementX/Y must be valid regardless of mouse lock state
                  is(e.movementX, eNow.screenX - ePrevious.screenX, "movementX shoulde equal eNow.screenX - ePrevious.screenX");
                  is(e.movementY, eNow.screenY - ePrevious.screenY, "movementY shoulde equal eNow.screenY - ePrevious.screenY");
                  }


                 }
                i = true;
                SimpleTest.finish();
                t++;
                    }
                }, false);
                document.body.addEventListener("mouseout", function (e) {
               i = false;   //if the pointer goes out from the browser, reset
                }, false);
            }, false);
        </script>
    </pre>

    <input type ="text" name ="txt" id="txt" />
</body>
</html>

The test is done

3 tests for movementX/Y are done (test #24,25,26)
I tried to retrieve the ePrevious's value directly, it costs me so long time and I'm still in confuse. So I use another way, create a variable to store the object and then compare with eNow.
Because movement is a dynamic implement, so the test won't take place as soon as others. User need to move the pointer in order to active the test.
For avoid thousands test result crush the browser, I limited the test in 4 times.

Friday, December 2, 2011

Mochitest need more time

I don't know why, there is a problem when I re-build the firefox that says permission deny, but will work after one or two more tries. Anyway, this costs me much more time to finish the test.

Monday, November 21, 2011

Finally done for Firefox build

After so many errors and OS/software conflicts. I finally got the build..(reinstall OS and all implements)
It seems I'm big fall behind than others, so I have to work more hard to catch up

Thursday, October 27, 2011

For 0.2

Subtitle control panel is done.

There are three color for select, red, blue, and white, after click the button then click 'play' button, the color of text will be changed
The text box will show what color you have selected
There are 2 bugs for now:
1, the shadow of the text will be stacked if user clicks the play button more than once.
2, color change cannot be activated by click the default play button in player

https://github.com/keyanr/popcorn-js/commit/aa2a773a0a1a5d735f3526b274df049fb415beb5   --This won't automatically construct

https://github.com/keyanr/popcorn-js/commit/5e19f84f02068b0773645918979975a7afd6cf9e


One bug is fixed for popup window for pause, the popup window will only show when the first time the video is paused

https://github.com/keyanr/popcorn-js/commit/f26075a2bb7342658116206cb2f214e17d9d1c6b

fix one document mistake in webpage plugin, the instruction says the upper webpage should disappear at 15 second, but in fact it was 10
https://github.com/keyanr/popcorn-js/commit/d34936b2281030a0db1e441fff6e8902ce33e906

Sunday, October 23, 2011

video reaction

The first thing i learn from the video is scope.
I never know I can do this in js
function assure_positive(matrix, n){
   for (var i = 0; i<n; i +=1){
      var row = matrix[i];
      for (var i = 0; i< row.length; i +=1){
          if(row[i] <0){
              throw new error('')
 }}}}
the way I usually did is define the variable with a new name

then, another thing surprises me is function in js can be called by too many or few argument, this usually makes a error in other language

I think the closure is a tricky point
Douglas shows a example in three ways:
1st:
var name = ["one", "two", "three"];
var digit_name=function (n){
 return name[n];
}
alert(digit_name(2));
this can works, but it will reduce the performance of the function if we just need the "name" variable in the only function digit_name

2nd:
var digit_name = function(n){
  var name = ["one", "two", "three"];
  return name;
};

alert(digit_name(2));
this also works, but it will take more time to process because we need declare the array every single time we call the function

var digit_name = (function (){
  var names = ['one', 'two', 'three'];
  return function (n){
    return name[n];
  };
}());
this is the best way that can avoid two problem happens before, and it is also js' feature.

Sunday, October 16, 2011

two new items...
https://github.com/keyanr/popcorn-js/commit/f4dd20af8e27ef2c1a6823749669e69aa8cfdebe
this can change the page's background color
there are many video website have "light off" feature, it can make the background into a dark color in order to make visitor more comfortable


https://github.com/keyanr/popcorn-js/commit/11ec0d848bfb6709d0c6c1330709e43d7be58a78
this add a tiresome feature, a popup window will be showed when user wants to pause the play, however this can often be found for adv.
it has a bug for now, if the play is already pause and click again to make it play, the popup window will still appear.

Sunday, October 2, 2011

about 0.1 release

Be honest, I didn't do enough work for 0.1.
I've chosen subtitle as the topic to develop. For this plugin I have two objectives:
1, create a panel that allow user can control subtitle's place, color, size
2, allow user's comment can show on the video when playing

unfortunately, I have no idea for both for now
for 1st one, I have trouble on passing variable to control the subtitle
for 2nd one, this has lot trouble on i/o, storage, etc, so I will put this down and focus on 1st one.

I tried to use a way like pause to do that, but it doesn't work, I have to find a way to pass variable between functions, or while calling an onclick function, and will execute instantly.

Sunday, September 25, 2011

Start with git

I have chosen popcorn as the topic for my project.
so first, I clone annasob's popcorn-js from git, and there is no problem in this step.
I took a quick look at the codes, but it seems not easy to understand in few minutes, so I left them their, and continue to try push.
but i'm stuck at this step, it always said permission deny(publickey), i'm trying to figure out what's that mean
After this little try, I compare git with svn,and find git has a big advantage, that is branch.
branch makes git very flexible, we can do different work in different branch at same time, but not affect each othet. For example, we are developing a prject, but a bug is reported, we can pause our work in hand to fix the bug, and then continue the develoment.

Friday, September 9, 2011

reaction to MS's license terms

Stubborn.
This is what I feel about microsoft's style, from their license term and hearsay
They always want to limit user. They don't want user know what they are using. They don't want user understand what they are using. For sure, they don't like user do anything change on what they are using.
Maybe this is a bad habit that most big companys own. They don't like others offend their authority, so they reject changes.
For make more money, as a really big company, we can't say this is wrong. They can monoplize the market and take client's money easily. That means, they have to face more challenges.
Open source softwares are hard to compeletly defeat the magnates, but they can effectually inhibit them. Because they allow user to check their product, so how many user they have, how many programer they have. That will be a sharp-cut blade for those poky company