update views

This commit is contained in:
Luke Pulverenti 2015-11-18 00:49:20 -05:00
parent 7f0e5e8cd8
commit 8c9287d505
15 changed files with 168 additions and 103 deletions

View file

@ -169,6 +169,8 @@
var deviceProfile = MediaPlayer.getDeviceProfile();
var timeLimitMs = MediaController.playbackTimeLimitMs || 0;
AndroidVlcPlayer.playVideoVlc(val,
startPosMs,
item.Name,
@ -184,7 +186,8 @@
ApiClient.getCurrentUserId(),
ApiClient.accessToken(),
JSON.stringify(deviceProfile),
JSON.stringify(videoQualityOptions));
JSON.stringify(videoQualityOptions),
timeLimitMs);
playerState.currentSrc = val;
self.report('playing', null, startPosMs, false, 100);

View file

@ -90,13 +90,13 @@
}, function () {
Logger.log('downloading: ' + originalUrl);
//Logger.log('downloading: ' + originalUrl);
var ft = new FileTransfer();
ft.download(originalUrl, path, function (entry) {
var localUrl = normalizeReturnUrl(entry.toURL());
Logger.log(localUrl);
//Logger.log(localUrl);
deferred.resolveWith(null, [localUrl]);
});
});

View file

@ -193,8 +193,6 @@
var duration = result.duration || 0;
var position = result.progress || 0;
Logger.log('eventName: ' + eventName + '. position: ' + position);
var state = AudioRenderer.Current.playerState;
state.duration = duration;
@ -202,12 +200,16 @@
state.paused = result.state == 3 || eventName == 'paused';
state.volume = 0;
if (eventName == 'positionchange') {
onTimeUpdate();
return;
}
Logger.log('eventName: ' + eventName + '. position: ' + position);
if (eventName == 'playbackstop') {
onEnded();
}
else if (eventName == 'positionchange') {
onTimeUpdate();
}
else if (eventName == 'paused') {
onPause();
}

View file

@ -31,8 +31,7 @@
return;
}
// Get supporter status
getRegistrationInfo(prefix + 'appunlock').done(function (registrationInfo) {
function onRegistrationInfoResponse(registrationInfo) {
if (registrationInfo.IsRegistered) {
deferred.resolve();
@ -49,14 +48,18 @@
}
var dialogOptions = {
title: Globalize.translate('HeaderUnlockApp')
title: Globalize.translate('HeaderUnlockApp'),
enablePlayMinute: feature == 'playback',
feature: feature
};
showInAppPurchaseInfo(subscriptionOptions, unlockableProductInfo, registrationInfo, dialogOptions, deferred);
showInAppPurchaseInfo(subscriptionOptions, unlockableProductInfo, dialogOptions, deferred);
});
}
}).fail(function () {
deferred.reject();
// Get supporter status
getRegistrationInfo(prefix + 'appunlock').done(onRegistrationInfoResponse).fail(function () {
onRegistrationInfoResponse({});
});
});
}
@ -144,13 +147,19 @@
html += '</p>';
}
if (dialogOptions.enablePlayMinute) {
html += '<p>';
html += '<paper-button raised class="secondary block btnCloseDialog subdued"><iron-icon icon="play-arrow"></iron-icon><span>' + Globalize.translate('ButtonPlayTwoMinutes') + '</span></paper-button>';
html += '</p>';
}
html += '</form>';
html += '</div>';
dlg.innerHTML = html;
document.body.appendChild(dlg);
initInAppPurchaseElementEvents(dlg, deferred);
initInAppPurchaseElementEvents(dlg, dialogOptions.feature, deferred);
PaperDialogHelper.openWithHash(dlg, 'iap');
@ -169,7 +178,7 @@
dlg.classList.add('inAppPurchaseOverlay');
}
function initInAppPurchaseElementEvents(elem, deferred) {
function initInAppPurchaseElementEvents(elem, feature, deferred) {
isCancelled = true;
@ -194,15 +203,31 @@
clearCurrentDisplayingInfo();
if (isCancelled) {
deferred.reject();
}
var overlay = this;
$(this).remove();
if (isCancelled) {
if (feature == 'playback') {
Dashboard.alert({
message: Globalize.translate('ThankYouForTryingEnjoyOneMinute'),
title: Globalize.translate('HeaderTryPlayback'),
callback: function () {
deferred.reject();
$(overlay).remove();
}
});
} else {
deferred.reject();
$(overlay).remove();
}
} else {
$(this).remove();
}
});
}
function showInAppPurchaseInfo(subscriptionOptions, unlockableProductInfo, serverRegistrationInfo, dialogOptions, deferred) {
function showInAppPurchaseInfo(subscriptionOptions, unlockableProductInfo, dialogOptions, deferred) {
require(['components/paperdialoghelper'], function () {
@ -262,9 +287,7 @@
return;
}
// Get supporter status
getRegistrationInfo('Sync').done(function (registrationInfo) {
function onRegistrationInfoResponse(registrationInfo) {
if (registrationInfo.IsRegistered) {
deferred.resolve();
return;
@ -273,14 +296,17 @@
IapManager.getSubscriptionOptions().done(function (subscriptionOptions) {
var dialogOptions = {
title: Globalize.translate('HeaderUnlockSync')
title: Globalize.translate('HeaderUnlockSync'),
feature: 'sync'
};
showInAppPurchaseInfo(subscriptionOptions, null, registrationInfo, dialogOptions, deferred);
showInAppPurchaseInfo(subscriptionOptions, null, dialogOptions, deferred);
});
}
}).fail(function () {
deferred.reject();
// Get supporter status
getRegistrationInfo('Sync').done(onRegistrationInfoResponse).fail(function () {
onRegistrationInfoResponse({});
});
});
}