Created
March 18, 2016 18:17
-
-
Save mhartington/21c882e06949d8ac28bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('starter', ['ionic', 'ngAudio']) | |
| .run(function($ionicPlatform) { | |
| $ionicPlatform.ready(function() { | |
| if (window.cordova && window.cordova.plugins.Keyboard) { | |
| cordova.plugins.Keyboard.disableScroll(true); | |
| } | |
| if (window.StatusBar) { | |
| StatusBar.styleDefault(); | |
| } | |
| }); | |
| }) | |
| .controller('MainCtrl', function($ionicPlatform) { | |
| var main = this; | |
| $ionicPlatform.ready().then(function() { | |
| if (window.cordova) { | |
| var media = new Media('sounds/sounds.mp3', function() { | |
| console.log("GOOD") | |
| }, function() { | |
| console.log("WE DONE FUCKED UP"); | |
| }); | |
| } | |
| main.play = function play() { | |
| console.log('this') | |
| media.play(); | |
| } | |
| main.pauseAudio = function pauseAudio(){ | |
| media.pause() | |
| } | |
| }) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> | |
| <title></title> | |
| <link href="lib/ionic/css/ionic.css" rel="stylesheet"> | |
| <link href="css/style.css" rel="stylesheet"> | |
| <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above | |
| <link href="css/ionic.app.css" rel="stylesheet"> | |
| --> | |
| <!-- ionic/angularjs js --> | |
| <script src="lib/ionic/js/ionic.bundle.js"></script> | |
| <!-- cordova script (this will be a 404 during development) --> | |
| <script src="cordova.js"></script> | |
| <!-- your app's js --> | |
| <script src="js/app.js"></script> | |
| </head> | |
| <body ng-app="starter"> | |
| <ion-pane ng-controller="MainCtrl as main"> | |
| <ion-header-bar class="bar-stable"> | |
| <h1 class="title">Ionic Blank Starter</h1> | |
| </ion-header-bar> | |
| <ion-content> | |
| <button class="button button-block" ng-click="main.play()">Click me</button> | |
| <button class="button button-block" ng-click="main.pauseAudio()">Click me</button> | |
| </ion-content> | |
| </ion-pane> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you mean to put ngAudio in here?