1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

chromecast testing

This commit is contained in:
Luke Pulverenti 2014-08-18 22:49:16 -04:00
parent 46f50bae6a
commit 952106daa9
6 changed files with 58 additions and 32 deletions

View file

@ -54,13 +54,13 @@
<fieldset data-role="controlgroup"> <fieldset data-role="controlgroup">
<legend>${LabelSupportedMediaTypes}</legend> <legend>${LabelSupportedMediaTypes}</legend>
<input type="checkbox" data-mini="true" id="chkAudio" data-value="Audio" class="chkMediaType" /> <input type="checkbox" id="chkAudio" data-value="Audio" class="chkMediaType" />
<label for="chkAudio">${OptionProfileAudio}</label> <label for="chkAudio">${OptionProfileAudio}</label>
<input type="checkbox" data-mini="true" id="chkPhoto" data-value="Photo" class="chkMediaType" /> <input type="checkbox" id="chkPhoto" data-value="Photo" class="chkMediaType" />
<label for="chkPhoto">${OptionProfilePhoto}</label> <label for="chkPhoto">${OptionProfilePhoto}</label>
<input type="checkbox" data-mini="true" id="chkVideo" data-value="Video" class="chkMediaType" /> <input type="checkbox" id="chkVideo" data-value="Video" class="chkMediaType" />
<label for="chkVideo">${OptionProfileVideo}</label> <label for="chkVideo">${OptionProfileVideo}</label>
</fieldset> </fieldset>

View file

@ -63,10 +63,10 @@
<div class="chapterDownloadSettings" style="display: none;"> <div class="chapterDownloadSettings" style="display: none;">
<fieldset data-role="controlgroup"> <fieldset data-role="controlgroup">
<legend>${HeaderDownloadChaptersFor}</legend> <legend>${HeaderDownloadChaptersFor}</legend>
<input type="checkbox" data-mini="true" id="chkDownloadChapterMovies" /> <input type="checkbox" id="chkDownloadChapterMovies" />
<label for="chkDownloadChapterMovies">${OptionMovies}</label> <label for="chkDownloadChapterMovies">${OptionMovies}</label>
<input type="checkbox" data-mini="true" id="chkDownloadChapterEpisodes" /> <input type="checkbox" id="chkDownloadChapterEpisodes" />
<label for="chkDownloadChapterEpisodes">${OptionEpisodes}</label> <label for="chkDownloadChapterEpisodes">${OptionEpisodes}</label>
</fieldset> </fieldset>
<br /> <br />
@ -84,13 +84,13 @@
<li> <li>
<label>${HeaderExtractChapterImagesFor}</label> <label>${HeaderExtractChapterImagesFor}</label>
<div data-role="controlgroup"> <div data-role="controlgroup">
<input type="checkbox" data-mini="true" id="chkChaptersMovies" /> <input type="checkbox" id="chkChaptersMovies" />
<label for="chkChaptersMovies">${OptionMovies}</label> <label for="chkChaptersMovies">${OptionMovies}</label>
<input type="checkbox" data-mini="true" id="chkChaptersEpisodes" /> <input type="checkbox" id="chkChaptersEpisodes" />
<label for="chkChaptersEpisodes">${OptionEpisodes}</label> <label for="chkChaptersEpisodes">${OptionEpisodes}</label>
<input type="checkbox" data-mini="true" id="chkChaptersOtherVideos" /> <input type="checkbox" id="chkChaptersOtherVideos" />
<label for="chkChaptersOtherVideos">${OptionOtherVideos}</label> <label for="chkChaptersOtherVideos">${OptionOtherVideos}</label>
<div class="fieldDescription">${ExtractChapterImagesHelp}</div> <div class="fieldDescription">${ExtractChapterImagesHelp}</div>
</div> </div>
@ -107,25 +107,25 @@
<li> <li>
<label>${HeaderDownloadPeopleMetadataFor}</label> <label>${HeaderDownloadPeopleMetadataFor}</label>
<div data-role="controlgroup"> <div data-role="controlgroup">
<input type="checkbox" data-mini="true" id="chkPeopleActors" /> <input type="checkbox" id="chkPeopleActors" />
<label for="chkPeopleActors">${OptionActors}</label> <label for="chkPeopleActors">${OptionActors}</label>
<input type="checkbox" data-mini="true" id="chkPeopleComposers" /> <input type="checkbox" id="chkPeopleComposers" />
<label for="chkPeopleComposers">${OptionComposers}</label> <label for="chkPeopleComposers">${OptionComposers}</label>
<input type="checkbox" data-mini="true" id="chkPeopleDirectors" /> <input type="checkbox" id="chkPeopleDirectors" />
<label for="chkPeopleDirectors">${OptionDirectors}</label> <label for="chkPeopleDirectors">${OptionDirectors}</label>
<input type="checkbox" data-mini="true" id="chkPeopleGuestStars" /> <input type="checkbox" id="chkPeopleGuestStars" />
<label for="chkPeopleGuestStars">${OptionGuestStars}</label> <label for="chkPeopleGuestStars">${OptionGuestStars}</label>
<input type="checkbox" data-mini="true" id="chkPeopleProducers" /> <input type="checkbox" id="chkPeopleProducers" />
<label for="chkPeopleProducers">${OptionProducers}</label> <label for="chkPeopleProducers">${OptionProducers}</label>
<input type="checkbox" data-mini="true" id="chkPeopleWriters" /> <input type="checkbox" id="chkPeopleWriters" />
<label for="chkPeopleWriters">${OptionWriters}</label> <label for="chkPeopleWriters">${OptionWriters}</label>
<input type="checkbox" data-mini="true" id="chkPeopleOthers" /> <input type="checkbox" id="chkPeopleOthers" />
<label for="chkPeopleOthers">${OptionOthers}</label> <label for="chkPeopleOthers">${OptionOthers}</label>
<div class="fieldDescription">${HeaderDownloadPeopleMetadataForHelp}</div> <div class="fieldDescription">${HeaderDownloadPeopleMetadataForHelp}</div>
</div> </div>

View file

@ -28,9 +28,9 @@
<br /> <br />
<div style="margin: 0 1em;" data-role="controlgroup"> <div style="margin: 0 1em;" data-role="controlgroup">
<label for="chkDisplayCollectionView">${LabelDisplayCollectionsView}</label> <label for="chkDisplayCollectionView">${LabelDisplayCollectionsView}</label>
<input id="chkDisplayCollectionView" type="checkbox" data-mini="true" /> <input id="chkDisplayCollectionView" type="checkbox" />
<label for="chkDisplayFolderView">${LabelDisplayFoldersView}</label> <label for="chkDisplayFolderView">${LabelDisplayFoldersView}</label>
<input id="chkDisplayFolderView" type="checkbox" data-mini="true" /> <input id="chkDisplayFolderView" type="checkbox" />
</div> </div>
<br /><br /> <br /><br />

View file

@ -20,7 +20,7 @@
var isChecked = config.DownloadingChannels.indexOf(channel.Id) != -1 ? ' checked="checked"' : ''; var isChecked = config.DownloadingChannels.indexOf(channel.Id) != -1 ? ' checked="checked"' : '';
html += '<input class="chkChannelDownload" type="checkbox" name="' + id + '" id="' + id + '" data-channelid="' + channel.Id + '" data-mini="true"' + isChecked + '>'; html += '<input class="chkChannelDownload" type="checkbox" name="' + id + '" id="' + id + '" data-channelid="' + channel.Id + '"' + isChecked + '>';
html += '<label for="' + id + '">' + channel.Name + '</label>'; html += '<label for="' + id + '">' + channel.Name + '</label>';
} }

View file

@ -205,6 +205,7 @@
this.deviceState = DEVICE_STATE.ACTIVE; this.deviceState = DEVICE_STATE.ACTIVE;
this.session.addMessageListener(messageNamespace, this.messageListener.bind(this)); this.session.addMessageListener(messageNamespace, this.messageListener.bind(this));
this.session.addMediaListener(this.sessionMediaListener.bind(this));
this.session.addUpdateListener(this.sessionUpdateListener.bind(this)); this.session.addUpdateListener(this.sessionUpdateListener.bind(this));
$(this).trigger('connect'); $(this).trigger('connect');
@ -212,6 +213,16 @@
MediaController.setActivePlayer(PlayerName); MediaController.setActivePlayer(PlayerName);
}; };
/**
* session update listener
*/
CastPlayer.prototype.sessionMediaListener = function (e) {
console.log('sessionMediaListener');
this.currentMediaSession = e;
this.currentMediaSession.addUpdateListener(this.mediaStatusUpdateHandler);
};
/** /**
* Callback function for launch error * Callback function for launch error
*/ */
@ -259,17 +270,22 @@
return; return;
} }
this.sendMessage({
options: options,
command: command
});
};
CastPlayer.prototype.sendMessage = function (message) {
var player = this; var player = this;
var message = { message = $.extend(message, {
options: options,
command: command,
userId: Dashboard.getCurrentUserId(), userId: Dashboard.getCurrentUserId(),
deviceId: ApiClient.deviceId(), deviceId: ApiClient.deviceId(),
accessToken: ApiClient.accessToken(), accessToken: ApiClient.accessToken(),
serverAddress: ApiClient.serverAddress() serverAddress: ApiClient.serverAddress()
}; });
// If the user is on localhost we need a different address to send to the receiver // If the user is on localhost we need a different address to send to the receiver
var address = message.serverAddress.toLowerCase(); var address = message.serverAddress.toLowerCase();
@ -278,20 +294,21 @@
ApiClient.getSystemInfo().done(function (info) { ApiClient.getSystemInfo().done(function (info) {
message.serverAddress = info.WanAddress; message.serverAddress = info.WanAddress;
player.sendMessage(message); player.sendMessageInternal(message);
}); });
} else { } else {
player.sendMessage(message); player.sendMessageInternal(message);
} }
}; };
CastPlayer.prototype.sendMessage = function(message) { CastPlayer.prototype.sendMessageInternal = function (message) {
message = JSON.stringify(message); message = JSON.stringify(message);
//console.log(message); //console.log(message);
this.session.sendMessage(messageNamespace, message, this.onPlayCommandSuccess.bind(this), this.errorHandler); this.session.sendMessage(messageNamespace, message, this.onPlayCommandSuccess.bind(this), this.errorHandler);
} };
CastPlayer.prototype.onPlayCommandSuccess = function () { CastPlayer.prototype.onPlayCommandSuccess = function () {
console.log('Message was sent to receiver ok.'); console.log('Message was sent to receiver ok.');
@ -514,6 +531,9 @@
$(castPlayer).on("playbackstart", function (e, data) { $(castPlayer).on("playbackstart", function (e, data) {
console.log('cc: playbackstart'); console.log('cc: playbackstart');
castPlayer.initializeCastPlayer();
var state = self.getPlayerStateInternal(data); var state = self.getPlayerStateInternal(data);
$(self).trigger("playbackstart", [state]); $(self).trigger("playbackstart", [state]);
}); });
@ -636,6 +656,10 @@
self.displayContent = function (options) { self.displayContent = function (options) {
castPlayer.sendMessage({
options: options,
command: 'DisplayContent'
});
}; };
self.mute = function () { self.mute = function () {
@ -683,7 +707,8 @@
"Mute", "Mute",
"Unmute", "Unmute",
"ToggleMute", "ToggleMute",
"SetVolume"] "SetVolume",
"DisplayContent"]
}; };
}; };
@ -747,6 +772,7 @@
data = data || self.lastPlayerData; data = data || self.lastPlayerData;
self.lastPlayerData = data; self.lastPlayerData = data;
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
return data; return data;
}; };

View file

@ -54,7 +54,7 @@
var checkedAttribute = user.Configuration.BlockedMediaFolders.indexOf(folder.Id) == -1 && user.Configuration.BlockedMediaFolders.indexOf(folder.Name) == -1 ? ' checked="checked"' : ''; var checkedAttribute = user.Configuration.BlockedMediaFolders.indexOf(folder.Id) == -1 && user.Configuration.BlockedMediaFolders.indexOf(folder.Name) == -1 ? ' checked="checked"' : '';
html += '<input class="chkMediaFolder" data-foldername="' + folder.Id + '" type="checkbox" data-mini="true" id="' + id + '"' + checkedAttribute + ' />'; html += '<input class="chkMediaFolder" data-foldername="' + folder.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + folder.Name + '</label>'; html += '<label for="' + id + '">' + folder.Name + '</label>';
} }
@ -79,7 +79,7 @@
var checkedAttribute = user.Configuration.BlockedChannels.indexOf(folder.Id) == -1 ? ' checked="checked"' : ''; var checkedAttribute = user.Configuration.BlockedChannels.indexOf(folder.Id) == -1 ? ' checked="checked"' : '';
html += '<input class="chkChannel" data-foldername="' + folder.Id + '" type="checkbox" data-mini="true" id="' + id + '"' + checkedAttribute + ' />'; html += '<input class="chkChannel" data-foldername="' + folder.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + folder.Name + '</label>'; html += '<label for="' + id + '">' + folder.Name + '</label>';
} }
@ -123,7 +123,7 @@
var checkedAttribute = user.Configuration.BlockUnratedItems.indexOf(item.value) != -1 ? ' checked="checked"' : ''; var checkedAttribute = user.Configuration.BlockUnratedItems.indexOf(item.value) != -1 ? ' checked="checked"' : '';
html += '<input class="chkUnratedItem" data-itemtype="' + item.value + '" type="checkbox" data-mini="true" id="' + id + '"' + checkedAttribute + ' />'; html += '<input class="chkUnratedItem" data-itemtype="' + item.value + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + item.name + '</label>'; html += '<label for="' + id + '">' + item.name + '</label>';
} }