From 32fbdee05f19db5b26a8b29bf749ba535ff82d75 Mon Sep 17 00:00:00 2001 From: Colin Frei Date: Wed, 21 Aug 2013 20:06:10 +0200 Subject: [PATCH] allow jumping playback --- index.html | 2 +- js/app.js | 2 +- js/controllers.js | 4 ++++ js/services.js | 8 +++++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index fef106d..ecf83a3 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ -
+
diff --git a/js/app.js b/js/app.js index 33fdfa5..63c076b 100644 --- a/js/app.js +++ b/js/app.js @@ -1,7 +1,7 @@ 'use strict'; // Declare app level module which depends on filters, and services -angular.module('podcasts', ['ngRoute', 'podcasts.services', 'podcasts.updater', 'podcasts.database', 'podcast.directives', 'podcasts.importer', 'podcasts.router']). +angular.module('podcasts', ['ngRoute', 'ngTouch', 'podcasts.services', 'podcasts.updater', 'podcasts.database', 'podcast.directives', 'podcasts.importer', 'podcasts.router']). config(['$routeProvider', function($routeProvider) { $routeProvider.when('/feeds', {templateUrl: 'partials/listFeeds.html', controller: FeedListCtrl}); $routeProvider.when('/feed/:feedId', {templateUrl: 'partials/feed.html', controller: FeedCtrl}); diff --git a/js/controllers.js b/js/controllers.js index 0230f33..de912c8 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -204,6 +204,10 @@ function TopBarCtrl($scope, player, pageSwitcher) $scope.showBackLink = function() { return !!pageSwitcher.backPage; }; + + $scope.jumpAudio = function(distance) { + player.jumpAudio(distance); + }; } function InfoCtrl(pageSwitcher) diff --git a/js/services.js b/js/services.js index 9af9791..1136284 100644 --- a/js/services.js +++ b/js/services.js @@ -154,6 +154,11 @@ angular.module('podcasts.services', ['podcasts.utilities', 'podcasts.queueList', }, 1000); } + function jumpAudio(distance) + { + audio.currentTime = audio.currentTime + distance; + } + return { audio: audio, @@ -163,7 +168,8 @@ angular.module('podcasts.services', ['podcasts.utilities', 'podcasts.queueList', pause: pause, playing: playing, updateSong: updateSong, - updatePosition: updatePosition + updatePosition: updatePosition, + jumpAudio: jumpAudio } }]) .service('pageSwitcher', ['$location', '$route', function($location, $route) {