Permalink
Browse files

fix callback bug

  • Loading branch information...
1 parent 4dd7ab4 commit a39f7888a4f0caf483c52c11a7ada944dc8c5e46 @eiffelqiu committed Jan 6, 2012
Showing with 44 additions and 46 deletions.
  1. +44 −46 www/js/app/main.js
View
90 www/js/app/main.js
@@ -6,62 +6,60 @@ var jQT = new $.jQTouch({
statusBar:'black'
});
-$(function() {
-
- // video plugin definition
- var vp;
- // Step 1: initialize plugins
- $(document).bind("deviceready", function() {
- vp = window.plugins.videoPlayer;
- });
+// video plugin definition
+var vp;
- // Step 2: prepare callback function for videoplugin
- var videoplayerCallBack = function(param) { // callback function should be: pluginname + CallBack
- if (param == 'finish') {
- $('#status').html("finish playing");
- navigator.notification.alert("finish");
- }
- };
+// Step 1: initialize plugins
+$(document).bind("deviceready", function() {
+ vp = window.plugins.videoPlayer;
+});
- var helper = {
- // Step 3: utility wrap function used by this page
+// Step 2: prepare callback function for videoplugin
+var videoplayerCallBack = function(param) { // callback function should be: pluginname + CallBack
+ if (param == 'finish') {
+ $('#status').html("finish playing");
+ navigator.notification.alert("finish");
+ }
+};
- // play video helper function
- play:function(movie, portrait) {
- vp.show(movie, portrait);
- },
+var helper = {
+ // Step 3: utility wrap function used by this page
- // info helper function
- info:function() {
- var data = {
- getInfo:function() {
- return "eiffel qiu"
- }
- };
- $("#info").html("").append($("#info-template").tmpl(data));
- }
- };
+ // play video helper function
+ play:function(movie, portrait) {
+ vp.show(movie, portrait);
+ },
- // Step 4: application logic
- var app = $.sammy(function() {
- this.use(Sammy.Tmpl);
+ // info helper function
+ info:function() {
+ var data = {
+ getInfo:function() {
+ return "eiffel qiu"
+ }
+ };
+ $("#info").html("").append($("#info-template").tmpl(data));
+ }
+};
- this.get('#/info', function() {
- helper.info();
- });
+// Step 4: application logic
+var app = $.sammy(function() {
+ this.use(Sammy.Tmpl);
- this.get('#/play1', function() {
- helper.play('movie.mp4', 'YES'); // 'YES' for portrait video
- });
+ this.get('#/info', function() {
+ helper.info();
+ });
- this.get('#/play2', function() {
- helper.play('http://easyhtml5video.com/images/happyfit2.mp4', 'NO'); // 'NO' for landscape video
- });
+ this.get('#/play1', function() {
+ helper.play('movie.mp4', 'YES'); // 'YES' for portrait video
});
- $(function() {
- app.run('#/');
+ this.get('#/play2', function() {
+ helper.play('http://easyhtml5video.com/images/happyfit2.mp4', 'NO'); // 'NO' for landscape video
});
+});
+
+$(function() {
+ app.run('#/');
+});
-});

0 comments on commit a39f788

Please sign in to comment.