allow jumping playback

This commit is contained in:
Colin Frei 2013-08-21 20:06:10 +02:00
parent d6b021bfaf
commit 32fbdee05f
4 changed files with 13 additions and 3 deletions

View file

@ -9,7 +9,7 @@
</head> </head>
<body> <body>
<!-- TODO: move topBar into it's own partial --> <!-- TODO: move topBar into it's own partial -->
<div class="topBar" ng-controller="TopBarCtrl"> <div class="topBar" ng-controller="TopBarCtrl" ng-swipe-left="jumpAudio(+5)" ng-swipe-right="jumpAudio(-5)">
<div id="pageSwitcher" class="topBarItem" hold="showPageSwitchMenu()" ng-click="changePage()"> <div id="pageSwitcher" class="topBarItem" hold="showPageSwitchMenu()" ng-click="changePage()">
<i id="pageswitch-back-arrow" class="pageswitch-icon icon-chevron-left ng-cloak" ng-show="showBackLink()"></i> <i id="pageswitch-back-arrow" class="pageswitch-icon icon-chevron-left ng-cloak" ng-show="showBackLink()"></i>
<i id="pageswitch-icon-settings" class="pageswitch-icon next icon-cogs"></i> <i id="pageswitch-icon-settings" class="pageswitch-icon next icon-cogs"></i>

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
// Declare app level module which depends on filters, and services // 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) { config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/feeds', {templateUrl: 'partials/listFeeds.html', controller: FeedListCtrl}); $routeProvider.when('/feeds', {templateUrl: 'partials/listFeeds.html', controller: FeedListCtrl});
$routeProvider.when('/feed/:feedId', {templateUrl: 'partials/feed.html', controller: FeedCtrl}); $routeProvider.when('/feed/:feedId', {templateUrl: 'partials/feed.html', controller: FeedCtrl});

View file

@ -204,6 +204,10 @@ function TopBarCtrl($scope, player, pageSwitcher)
$scope.showBackLink = function() { $scope.showBackLink = function() {
return !!pageSwitcher.backPage; return !!pageSwitcher.backPage;
}; };
$scope.jumpAudio = function(distance) {
player.jumpAudio(distance);
};
} }
function InfoCtrl(pageSwitcher) function InfoCtrl(pageSwitcher)

View file

@ -154,6 +154,11 @@ angular.module('podcasts.services', ['podcasts.utilities', 'podcasts.queueList',
}, 1000); }, 1000);
} }
function jumpAudio(distance)
{
audio.currentTime = audio.currentTime + distance;
}
return { return {
audio: audio, audio: audio,
@ -163,7 +168,8 @@ angular.module('podcasts.services', ['podcasts.utilities', 'podcasts.queueList',
pause: pause, pause: pause,
playing: playing, playing: playing,
updateSong: updateSong, updateSong: updateSong,
updatePosition: updatePosition updatePosition: updatePosition,
jumpAudio: jumpAudio
} }
}]) }])
.service('pageSwitcher', ['$location', '$route', function($location, $route) { .service('pageSwitcher', ['$location', '$route', function($location, $route) {