Skip to content

Commit

Permalink
FLUID-4775: Fixed the unit tests for controllers as well as the code …
Browse files Browse the repository at this point in the history
…clean-up.
  • Loading branch information
cindyli committed Aug 21, 2012
1 parent d5e8c80 commit 10f4730
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
1 change: 0 additions & 1 deletion js/VideoPlayer_framework.js
Expand Up @@ -189,7 +189,6 @@ var fluid_1_5 = fluid_1_5 || {};
return fluid.get(that.model, fluid.get(that.options, pathName));
};
that.writeIndirect = function(pathName, value, source) {
console.log("fire: " + pathName + "; value: " + value + "; source: " + source);
fluid.fireSourcedChange(that.applier, fluid.get(that.options, pathName), value, source);
};
};
Expand Down
17 changes: 3 additions & 14 deletions js/VideoPlayer_media.js
Expand Up @@ -98,7 +98,6 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt

var bindMediaDOMEvents = function (that) {
MediaElement(that.container[0], {success: function (mediaElementVideo) {
console.log('assigning');
that.model.mediaElementVideo = mediaElementVideo;

// IE8 workaround to trigger the video initial loading. Otherwise, a blank is displayed at the video area
Expand All @@ -107,7 +106,6 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt

mediaElementVideo.addEventListener("durationchange", function () {
// FF doesn't implement startTime from the HTML 5 spec.
console.log("event duration change");
var startTime = mediaElementVideo.startTime || 0;
that.applier.fireChangeRequest({
path: "totalTime",
Expand All @@ -124,7 +122,6 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
});

mediaElementVideo.addEventListener("volumechange", function () {
console.log("event volume change");
var mediaVolume = mediaElementVideo.volume * 100;
// Don't fire self-generated volume changes on zero when muted, to avoid cycles
if (!that.model.muted || mediaVolume !== 0) {
Expand All @@ -134,31 +131,27 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt

// all browser don't support the canplay so we do all different states
mediaElementVideo.addEventListener("canplay", function () {
console.log("event canplay");
that.applier.fireChangeRequest({
path: "canPlay",
value: getcanPlayData(mediaElementVideo)
});
});

mediaElementVideo.addEventListener("canplaythrough", function () {
console.log("event canplaythrough");
that.applier.fireChangeRequest({
path: "canPlay",
value: getcanPlayData(mediaElementVideo)
});
});

mediaElementVideo.addEventListener("loadeddata", function () {
console.log("event loadeddata");
that.applier.fireChangeRequest({
path: "canPlay",
value: getcanPlayData(mediaElementVideo)
});
});

mediaElementVideo.addEventListener("ended", function () {
console.log("event ended");
that.applier.fireChangeRequest({
path: "play",
value: false
Expand All @@ -181,7 +174,6 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt

fluid.videoPlayer.media.preInit = function (that) {
that.updateCurrentTime = function (currentTime, buffered) {
console.log("updateCurrentTime: " + currentTime);
that.applier.fireChangeRequest({
path: "currentTime",
value: currentTime
Expand All @@ -194,32 +186,29 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt

that.setTime = function (time) {
if (!that.model.mediaElementVideo) return;
console.log("in setTime");

that.model.mediaElementVideo.currentTime = time;
};

that.updateVolume = function () {
if (!that.model.mediaElementVideo) return;
console.log("in updateVolume");

that.model.mediaElementVideo.volume = that.model.volume / 100;
};

that.play = function () {
console.log("play");
if (!that.model.mediaElementVideo) return;

if (that.model.play === true) {
console.log("in play - play");
that.model.mediaElementVideo.play();
} else {
console.log("in play - pause");
that.model.mediaElementVideo.pause();
}
};

that.mute = function () {
if (!that.model.mediaElementVideo) return;
console.log("in mute");

that.model.mediaElementVideo.muted = that.model.muted;
};

Expand Down
4 changes: 4 additions & 0 deletions tests/js/VideoPlayerControlsTests.js
Expand Up @@ -31,6 +31,10 @@ fluid.registerNamespace("fluid.tests");
{
src: "TestVideo.mp4",
type: "video/mp4"
},
{
src: "../../demos/videos/ReorganizeFuture/ReorganizeFuture.webm",
type: "video/webm"
}
]
},
Expand Down

0 comments on commit 10f4730

Please sign in to comment.