|
|
@ -2341,7 +2341,7 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.directive('myLoadRound', function (AppDocsManager, $timeout) { |
|
|
|
.directive('myLoadRound', function (AppMessagesManager, AppDocsManager, $timeout) { |
|
|
|
|
|
|
|
|
|
|
|
var currentPlayer = false |
|
|
|
var currentPlayer = false |
|
|
|
var currentPlayerScope = false |
|
|
|
var currentPlayerScope = false |
|
|
@ -2367,14 +2367,53 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
currentPlayerScope = newScope |
|
|
|
currentPlayerScope = newScope |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function readVideoMessage($scope) { |
|
|
|
|
|
|
|
if ($scope.message && |
|
|
|
|
|
|
|
!$scope.message.pFlags.out && |
|
|
|
|
|
|
|
$scope.message.pFlags.media_unread) { |
|
|
|
|
|
|
|
AppMessagesManager.readMessages([$scope.message.mid]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toggleVideoPlayer ($scope, element) { |
|
|
|
|
|
|
|
var video = $('video', element)[0] |
|
|
|
|
|
|
|
if (video) { |
|
|
|
|
|
|
|
if (!$scope.isActive) { |
|
|
|
|
|
|
|
video.pause() |
|
|
|
|
|
|
|
video.currentTime = 0 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
checkPlayer(video, $scope) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var promise = video.play() |
|
|
|
|
|
|
|
if (promise && promise.then) { |
|
|
|
|
|
|
|
promise.then(function () { |
|
|
|
|
|
|
|
$scope.needClick = false |
|
|
|
|
|
|
|
readVideoMessage($scope) |
|
|
|
|
|
|
|
}, function () { |
|
|
|
|
|
|
|
$scope.needClick = true |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
readVideoMessage($scope) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return video |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function link ($scope, element, attrs) { |
|
|
|
function link ($scope, element, attrs) { |
|
|
|
var imgWrap = $('.img_round_image_wrap', element) |
|
|
|
var imgWrap = $('.img_round_image_wrap', element) |
|
|
|
imgWrap.css({width: $scope.document.thumb.width, height: $scope.document.thumb.height}) |
|
|
|
imgWrap.css({width: $scope.document.thumb.width, height: $scope.document.thumb.height}) |
|
|
|
|
|
|
|
|
|
|
|
var downloadPromise = false |
|
|
|
var downloadPromise = false |
|
|
|
|
|
|
|
var peerChanged = false |
|
|
|
|
|
|
|
|
|
|
|
$scope.isActive = false |
|
|
|
$scope.isActive = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($scope.$parent.messageId) { |
|
|
|
|
|
|
|
$scope.message = AppMessagesManager.wrapForHistory($scope.$parent.messageId) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$scope.toggle = function (e) { |
|
|
|
$scope.toggle = function (e) { |
|
|
|
if (e && checkClick(e, true)) { |
|
|
|
if (e && checkClick(e, true)) { |
|
|
|
AppDocsManager.saveDocFile($scope.document.id) |
|
|
|
AppDocsManager.saveDocFile($scope.document.id) |
|
|
@ -2382,20 +2421,15 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($scope.document.url) { |
|
|
|
if ($scope.document.url) { |
|
|
|
|
|
|
|
if ($scope.needClick) { |
|
|
|
|
|
|
|
if (toggleVideoPlayer($scope, element)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
$scope.isActive = !$scope.isActive |
|
|
|
$scope.isActive = !$scope.isActive |
|
|
|
onContentLoaded(function () { |
|
|
|
onContentLoaded(function () { |
|
|
|
$scope.$emit('ui_height') |
|
|
|
$scope.$emit('ui_height') |
|
|
|
|
|
|
|
toggleVideoPlayer($scope, element) |
|
|
|
var video = $('video', element)[0] |
|
|
|
|
|
|
|
if (video) { |
|
|
|
|
|
|
|
if (!$scope.isActive) { |
|
|
|
|
|
|
|
video.pause() |
|
|
|
|
|
|
|
video.currentTime = 0 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
checkPlayer(video, $scope) |
|
|
|
|
|
|
|
video.play() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -2406,18 +2440,22 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
peerChanged = false |
|
|
|
downloadPromise = AppDocsManager.downloadDoc($scope.document.id) |
|
|
|
downloadPromise = AppDocsManager.downloadDoc($scope.document.id) |
|
|
|
|
|
|
|
|
|
|
|
downloadPromise.then(function () { |
|
|
|
downloadPromise.then(function () { |
|
|
|
$timeout(function () { |
|
|
|
$timeout(function () { |
|
|
|
var video = $('video', element)[0] |
|
|
|
if (!peerChanged) { |
|
|
|
checkPlayer(video, $scope) |
|
|
|
$scope.isActive = true |
|
|
|
$(video).on('ended', function () { |
|
|
|
} |
|
|
|
if ($scope.isActive) { |
|
|
|
var video = toggleVideoPlayer($scope, element) |
|
|
|
$scope.toggle() |
|
|
|
if (video) { |
|
|
|
} |
|
|
|
$(video).on('ended', function () { |
|
|
|
}) |
|
|
|
if ($scope.isActive) { |
|
|
|
$scope.isActive = true |
|
|
|
$scope.toggle() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}, 200) |
|
|
|
}, 200) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -2426,6 +2464,14 @@ angular.module('myApp.directives', ['myApp.filters']) |
|
|
|
if ($scope.isActive) { |
|
|
|
if ($scope.isActive) { |
|
|
|
$scope.toggle() |
|
|
|
$scope.toggle() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
peerChanged = true |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.$on('$destroy', function () { |
|
|
|
|
|
|
|
if (downloadPromise) { |
|
|
|
|
|
|
|
downloadPromise.cancel() |
|
|
|
|
|
|
|
downloadPromise = false |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|