Permalink
Browse files

Added Play / Pause buttons.

  • Loading branch information...
1 parent a72d0a4 commit 3754c2f83dea22967963c91ac5fc6ad885eff7c2 Michael Bebenita committed Nov 4, 2011
Showing with 501 additions and 508 deletions.
  1. +13 −2 Avc/hooks.js
  2. +1 −7 Avc/main.cpp
  3. +26 −16 Demo/broadway.html
  4. +431 −453 Demo/broadway.js
  5. +30 −30 Demo/jquery/{ → theme}/jquery-ui.css
View
@@ -3,14 +3,25 @@ FS['createDataFile'] = FS.createDataFile;
// Replace main loop handler
+var breakLoop = false;
__Z11runMainLoopv = function() {
window.addEventListener("message", function() {
- window.postMessage(0, "*")
__Z17mainLoopIterationv();
+ if (!breakLoop) {
+ window.postMessage(0, "*")
+ }
}, false);
- window.postMessage(0, "*")
}
+Module['play'] = function() {
+ breakLoop = false;
+ window.postMessage(0, "*")
+};
+
+Module['stop'] = function() {
+ breakLoop = true;
+};
+
// SDL hook
var frameCounter = 0, totalFrameCounter = 0;
View
@@ -112,13 +112,7 @@ int SDL_main(int argc, char **argv) {
void runMainLoop() {
mainLoopStatus status;
- while ((status = mainLoopIteration()) != MLS_STOP) {
- if (status == MLS_FRAMERENDERED) {
-#if RENDER
- // SDL_Delay(1000 / 100);
-#endif
- }
- }
+ while ((status = mainLoopIteration()) != MLS_STOP);
}
extern "C" float getPosition() {
View
@@ -78,11 +78,12 @@
#scrubber {
margin-left: 120px;
margin-top: 12px;
+ margin-right: 10px;
}
</style>
- <link type="text/css" href="jquery/jquery-ui.css" rel="stylesheet" />
+ <link type="text/css" href="jquery/theme/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript"
@@ -145,21 +146,8 @@
document.getElementById('score').innerHTML = "Calculating: " + (scoreTimeout - elapsed).toFixed(0);
}
}
-
- function stop() {
- clearInterval(Module.mainLoopInterval);
- }
-
- var playing = false;
- function play() {
- if (playing == false) {
- $('#play').children().first().html("Pause");
- playing = true;
- } else {
- $('#play').children().first().html("Play");
- playing = false;
- return;
- }
+
+ function load() {
document.getElementById('downloadProgress').innerHTML = "Downloading, Please Wait ...";
var clip = $("#clip").val();
var mode = $("#mode").val();
@@ -200,6 +188,28 @@
console.info("Running: " + clip);
Module.run(['video.264']);
}
+
+ var loaded = false;
+ var playing = false;
+
+
+ function play() {
+ if (!loaded) {
+ load();
+ loaded = true;
+ }
+
+ if (playing == false) {
+ $('#play').children().first().html("Pause");
+ playing = true;
+ Module.play();
+ } else {
+ $('#play').children().first().html("Play");
+ playing = false;
+ Module.stop();
+ return;
+ }
+ }
var glCanvasInitialized = false;
Oops, something went wrong.

0 comments on commit 3754c2f

Please sign in to comment.