diff --git a/app/css/app.css b/app/css/app.css index 623cc18b..f7d12aa1 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -1456,6 +1456,9 @@ img.im_message_document_thumb { white-space: nowrap; text-overflow: ellipsis; } +.audio_player_title:hover { + color: #222; +} .audio_player_meta { overflow: hidden; vertical-align: text-top; diff --git a/app/js/directives.js b/app/js/directives.js index 5610f8ee..148c5ebb 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1822,7 +1822,7 @@ angular.module('myApp.directives', ['myApp.filters']) } }) - .directive('myAudioPlayer', function ($sce, $timeout, MtpApiFileManager) { + .directive('myAudioPlayer', function ($sce, $timeout, $q, FileManager, MtpApiFileManager) { return { link: link, @@ -1847,6 +1847,7 @@ angular.module('myApp.directives', ['myApp.filters']) return downloadPromise.then(function (url) { delete audio.progress; + audio.rawUrl = url; audio.url = $sce.trustAsResourceUrl(url); }, function (e) { console.log('audio download failed', e); @@ -1861,6 +1862,14 @@ angular.module('myApp.directives', ['myApp.filters']) function link($scope, element, attrs) { $scope.mediaPlayer = {}; + $scope.download = function () { + ($scope.audio.rawUrl ? $q.when() : downloadAudio($scope.audio)).then( + function () { + FileManager.download($scope.audio.rawUrl, $scope.audio.mime_type || 'audio/ogg', $scope.audio.file_name || 'audio.ogg'); + } + ); + }; + $scope.togglePlay = function () { if ($scope.audio.url) { $scope.mediaPlayer.player.playPause(); @@ -1870,15 +1879,11 @@ angular.module('myApp.directives', ['myApp.filters']) } else { downloadAudio($scope.audio).then(function () { - $timeout(function () { - var audioElement = $('audio', element)[0]; - if (audioElement) { - audioElement.autoplay = false; - audioElement.removeAttribute('autoplay'); - } - }, 1000); + onContentLoaded(function () { + $scope.mediaPlayer.player.play(); + }) }) } - } + }; } }) diff --git a/app/partials/desktop/audio_player.html b/app/partials/desktop/audio_player.html index e4054136..3a3a7d78 100644 --- a/app/partials/desktop/audio_player.html +++ b/app/partials/desktop/audio_player.html @@ -3,12 +3,13 @@
-
+ -
-
- + +
+ +
@@ -24,7 +25,7 @@
-