Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added integration key to basic demo and added api key validation to t…

…he dropzone_history
  • Loading branch information...
commit 103969b5b0eaf35639725efb22d99f8ca53b0e62 1 parent 7accd8f
Matthew McClure authored March 19, 2013
4  basic.html
@@ -10,11 +10,11 @@
10 10
     <script type="text/javascript">  
11 11
       $(function() {
12 12
         filepicker.setKey('A9gfeq0CMTMeP1dR86vcxz');
13  
-        var zenKey = 'c3b3bd3daa0d33ecc184e751f055db64';
  13
+        var zenKey = 'ce887203717c4417267eeb7b59b55885';
14 14
         $('a').click(function(e) {
15 15
           e.preventDefault(); // This keeps the normal link behavior from happening
16 16
           var acceptedExtensions = ['3g2','3gp','3gp2','3gpp','3gpp2','aac','ac3','eac3','ec3','f4a','f4b','f4v','flv','highwinds','m4a','m4b','m4r','m4v','mkv','mov','mp3','mp4','oga','ogg','ogv','ogx','ts','webm','wma','wmv'];
17  
-          filepicker.pickAndStore({extensions: acceptedExtensions},{},function(fpfiles){
  17
+          filepicker.pickAndStore({extensions: acceptedExtensions},{location: 's3'},function(fpfiles){
18 18
             // This is the simplest Zencoder API call you can make. This will output an h.264 mp4 with AAC audio and
19 19
             // save it to Zencoder's temporary storage on S3.
20 20
             var request = {
5  component.json
... ...
@@ -1,5 +0,0 @@
1  
-{
2  
-  "dependencies": {
3  
-    "component/dialog": "*"
4  
-  }
5  
-}
20  dropzone_history.html
@@ -59,6 +59,8 @@
59 59
             border: 3px solid #fff;
60 60
         }
61 61
         #setup input:focus { outline: none; }
  62
+        #setup input.error { border-color: #EF0000;}
  63
+        .error { color: #EF0000; }
62 64
         /* Styling placeholder text still takes vendor prefixes :( */
63 65
         ::-webkit-input-placeholder {
64 66
            color: #47758F;
@@ -269,6 +271,7 @@
269 271
 
270 272
             /* Clear all the data and refresh the page */
271 273
             $('#clearData').click(function(e) {
  274
+                e.preventDefault();
272 275
                 localStorage.clear();
273 276
                 document.location.reload();
274 277
             });
@@ -348,7 +351,21 @@
348 351
                         }
349 352
                     }
350 353
                 },
351  
-                error: function(data) { console.log(data) }
  354
+                error: function(data) {
  355
+                    var errorMsg;
  356
+                    if (data.status == 401) {
  357
+                        // API key was incorrect...
  358
+                        errorMsg = 'Invalid Zencoder API Key';
  359
+                    } else {
  360
+                        errorMsg = "Something went wrong!"
  361
+                    }
  362
+                    localStorage.clear();
  363
+                    $('#dropZone, #historyBar, #navigation').hide();
  364
+                    // Let the user know what the error was
  365
+                    $('#api-key').addClass('error');
  366
+                    $('.alert').replaceWith('<p class="alert error">'+ errorMsg + '</p>');
  367
+                    $('#setup').fadeIn();
  368
+                }
352 369
             });
353 370
         }
354 371
         // List the last 50 jobs along the bottom
@@ -387,6 +404,7 @@
387 404
                     <form id="api-key-form">
388 405
                         <input type="text" id="api-key" placeholder="Zencoder API Key"><br />
389 406
                         <p>Press enter when done.</p>
  407
+                        <p class='alert'></p>
390 408
                     </form>
391 409
                 </div>
392 410
             </div>

0 notes on commit 103969b

Please sign in to comment.
Something went wrong with that request. Please try again.