added live channel playback

This commit is contained in:
Luke Pulverenti 2014-01-02 23:58:22 -05:00
parent 7ec31feea3
commit 708ca5d32f
7 changed files with 124 additions and 13 deletions

View File

@ -93,3 +93,10 @@
.ui-nosvg .ui-icon-subtitles:after { .ui-nosvg .ui-icon-subtitles:after {
background-image: url("images/icons/subtitles.png"); background-image: url("images/icons/subtitles.png");
} }
.ui-icon-tv:after {
background-image: url("images/icons/tv.png");
}
/* Fallback */
.ui-nosvg .ui-icon-tv:after {
background-image: url("images/icons/tv.png");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

View File

@ -24,7 +24,7 @@
<p><strong>A new version of Media Browser Server is available!</strong></p> <p><strong>A new version of Media Browser Server is available!</strong></p>
<p id="newVersionNumber"></p> <p id="newVersionNumber"></p>
<div id="btnUpdateApplicationContainer"> <div id="btnUpdateApplicationContainer">
<button id="btnUpdateApplication" type="button" data-icon="arrow-d" data-theme="b">Update Now</button> <button id="btnUpdateApplication" type="button" data-icon="arrow-d" data-theme="b" onclick="DashboardPage.updateApplication();">Update Now</button>
</div> </div>
<div id="btnManualUpdateContainer"> <div id="btnManualUpdateContainer">
Please shutdown the server and <a href="http://www.mediabrowser3.com/download" target="_blank">update manually.</a> Please shutdown the server and <a href="http://www.mediabrowser3.com/download" target="_blank">update manually.</a>

View File

@ -564,6 +564,9 @@
if (item.Type == "Channel") { if (item.Type == "Channel") {
return "livetvchannel.html?id=" + id; return "livetvchannel.html?id=" + id;
} }
if (item.Type == "Program") {
return "livetvprogram.html?id=" + id;
}
if (item.Type == "Series") { if (item.Type == "Series") {
return "itemdetails.html?id=" + id; return "itemdetails.html?id=" + id;
} }
@ -599,10 +602,8 @@
} }
if (item.Type == "MusicArtist") { if (item.Type == "MusicArtist") {
if (itemByNameContext == "music") {
return "itembynamedetails.html?musicartist=" + ApiClient.encodeName(item.Name) + "&context=" + (itemByNameContext || "music"); return "itembynamedetails.html?musicartist=" + ApiClient.encodeName(item.Name) + "&context=" + (itemByNameContext || "music");
} }
}
return item.IsFolder ? (id ? "itemlist.html?parentId=" + id : "#") : "itemdetails.html?id=" + id; return item.IsFolder ? (id ? "itemlist.html?parentId=" + id : "#") : "itemdetails.html?id=" + id;

View File

@ -24,6 +24,7 @@
self.playlist = []; self.playlist = [];
var currentPlaylistIndex = 0; var currentPlaylistIndex = 0;
var channelsList;
function requestFullScreen(element) { function requestFullScreen(element) {
// Supports most browsers and their versions. // Supports most browsers and their versions.
@ -283,6 +284,16 @@
hideFlyout($('#qualityFlyout')); hideFlyout($('#qualityFlyout'));
}); });
$('#channelsFlyout').on('click', '.mediaFlyoutOption', function () {
if (!$(this).hasClass('selectedMediaFlyoutOption')) {
var channelId = this.getAttribute('data-channelid');
self.playById(channelId, 'Channel');
}
hideFlyout($('#channelsFlyout'));
});
}); });
function endsWith(text, pattern) { function endsWith(text, pattern) {
@ -312,7 +323,7 @@
positionSlider.val(percent).slider('enable').slider('refresh'); positionSlider.val(percent).slider('enable').slider('refresh');
} }
} else { } else {
positionSlider.slider('disable'); positionSlider.slider('disable').slider('refresh');
} }
currentTimeElement.html(timeText); currentTimeElement.html(timeText);
@ -389,6 +400,7 @@
$('#audioTracksButton', nowPlayingBar).hide(); $('#audioTracksButton', nowPlayingBar).hide();
$('#subtitleButton', nowPlayingBar).hide(); $('#subtitleButton', nowPlayingBar).hide();
$('#chaptersButton', nowPlayingBar).hide(); $('#chaptersButton', nowPlayingBar).hide();
$('#channelsButton', nowPlayingBar).hide();
$('#mediaElement', nowPlayingBar).html(html); $('#mediaElement', nowPlayingBar).html(html);
var audioElement = $("audio", nowPlayingBar); var audioElement = $("audio", nowPlayingBar);
@ -583,6 +595,8 @@
$('#fullscreenButton', nowPlayingBar).show(); $('#fullscreenButton', nowPlayingBar).show();
} }
var channelsButton = $('#channelsButton', nowPlayingBar).hide();
var videoElement = $("video", nowPlayingBar); var videoElement = $("video", nowPlayingBar);
var initialVolume = localStorage.getItem("volume") || 0.5; var initialVolume = localStorage.getItem("volume") || 0.5;
@ -641,6 +655,22 @@
currentItem = item; currentItem = item;
curentDurationTicks = item.RunTimeTicks; curentDurationTicks = item.RunTimeTicks;
if (!channelsList) {
ApiClient.getLiveTvChannels({
userId: Dashboard.getCurrentUserId()
}).done(function (result) {
channelsList = result.Items;
if (result.Items.length) {
channelsButton.show();
}
});
}
return videoElement[0]; return videoElement[0];
}; };
@ -919,13 +949,24 @@
tag: item.ImageTags.Thumb tag: item.ImageTags.Thumb
}); });
} else { }
else if (item.Type == "Channel" || item.Type == "Recording") {
url = "css/images/items/detail/tv.png";
}
else if (item.MediaType == "Audio") {
url = "css/images/items/detail/audio.png";
}
else {
url = "css/images/items/detail/video.png"; url = "css/images/items/detail/video.png";
} }
var name = item.Name; var name = item.Name;
var seriesName = ''; var seriesName = '';
// Channel number
if (item.Number) {
name = item.Number + ' ' + name;
}
if (item.IndexNumber != null) { if (item.IndexNumber != null) {
name = item.IndexNumber + " - " + name; name = item.IndexNumber + " - " + name;
} }
@ -935,10 +976,15 @@
if (item.SeriesName || item.Album || item.ProductionYear) { if (item.SeriesName || item.Album || item.ProductionYear) {
seriesName = item.SeriesName || item.Album || item.ProductionYear; seriesName = item.SeriesName || item.Album || item.ProductionYear;
} }
if (item.CurrentProgram) {
seriesName = item.CurrentProgram.Name;
}
html += "<div><a href='itemdetails.html?id=" + item.Id + "'><img class='nowPlayingBarImage ' alt='' title='' src='" + url + "' style='height:36px;display:inline-block;' /></a></div>"; var href = LibraryBrowser.getHref(item.CurrentProgram || item);
if (item.SeriesName || item.Album) { html += "<div><a href='" + href + "'><img class='nowPlayingBarImage ' alt='' title='' src='" + url + "' style='height:36px;display:inline-block;' /></a></div>";
if (item.SeriesName || item.Album || item.CurrentProgram) {
html += '<div class="nowPlayingText">' + seriesName + '<br/>' + name + '</div>'; html += '<div class="nowPlayingText">' + seriesName + '<br/>' + name + '</div>';
} else { } else {
html += '<div class="nowPlayingText">' + name + '<br/>' + seriesName + '</div>'; html += '<div class="nowPlayingText">' + name + '<br/>' + seriesName + '</div>';
@ -1340,7 +1386,9 @@
}; };
function hideFlyout(flyout) { function hideFlyout(flyout) {
flyout.hide().empty(); flyout.hide().empty();
$(document.body).off("mousedown.hidesearchhints"); $(document.body).off("mousedown.hidesearchhints");
} }
@ -1579,8 +1627,8 @@
var html = ''; var html = '';
var videoStream = item.MediaStreams.filter(function (i) { var videoStream = (item.MediaStreams || []).filter(function (stream) {
return i.Type == "Video"; return stream.Type == "Video";
})[0]; })[0];
var currentVideoBitrate = getParameterByName('videoBitrate', currentMediaElement.currentSrc); var currentVideoBitrate = getParameterByName('videoBitrate', currentMediaElement.currentSrc);
@ -1641,6 +1689,58 @@
return html; return html;
} }
function getChannelsFlyoutHtml(channels) {
var html = '';
for (var i = 0, length = channels.length; i < length; i++) {
var channel = channels[i];
html += '<div data-channelid="' + channel.Id + '" class="mediaFlyoutOption">';
var imgUrl;
if (channel.ImageTags.Primary) {
imgUrl = ApiClient.getUrl("LiveTV/Channels/" + channel.Id + "/Images/Primary", {
maxwidth: 200,
tag: channel.ImageTags.Primary,
type: "Primary"
});
}
else {
imgUrl = "css/images/media/tvflyout.png";
}
html += '<img class="mediaFlyoutOptionImage" src="' + imgUrl + '" />';
html += '<div class="mediaFlyoutOptionContent">';
var name = channel.Number + ' ' + channel.Name;
html += '<div class="mediaFlyoutOptionName">' + name + '</div>';
html += '<div class="mediaFlyoutOptionSecondaryText">' + channel.CurrentProgram.Name + '</div>';
html += '</div>';
html += "</div>";
}
return html;
}
self.showChannelsFlyout = function () {
var flyout = $('#channelsFlyout');
var channels = channelsList || [];
showFlyout(flyout, '#channelsButton');
flyout.html(getChannelsFlyoutHtml(channels)).scrollTop(0);
};
self.showAudioTracksFlyout = function () { self.showAudioTracksFlyout = function () {
var flyout = $('#audioTracksFlyout'); var flyout = $('#audioTracksFlyout');

View File

@ -1337,6 +1337,9 @@ $(function () {
footerHtml += '<button onclick="MediaPlayer.showChaptersFlyout();" id="chaptersButton" class="mediaButton chaptersButton" title="Scenes" type="button" data-icon="video" data-iconpos="notext" data-inline="true">Scenes</button>'; footerHtml += '<button onclick="MediaPlayer.showChaptersFlyout();" id="chaptersButton" class="mediaButton chaptersButton" title="Scenes" type="button" data-icon="video" data-iconpos="notext" data-inline="true">Scenes</button>';
footerHtml += '<div class="mediaFlyoutContainer"><div id="chaptersFlyout" style="display:none;" class="mediaPlayerFlyout chaptersFlyout"></div></div>'; footerHtml += '<div class="mediaFlyoutContainer"><div id="chaptersFlyout" style="display:none;" class="mediaPlayerFlyout chaptersFlyout"></div></div>';
footerHtml += '<button onclick="MediaPlayer.showChannelsFlyout();" id="channelsButton" class="mediaButton channelsButton" title="Channels" type="button" data-icon="tv" data-iconpos="notext" data-inline="true">Channels</button>';
footerHtml += '<div class="mediaFlyoutContainer"><div id="channelsFlyout" style="display:none;" class="mediaPlayerFlyout channelsFlyout"></div></div>';
footerHtml += '<button onclick="MediaPlayer.toggleFullscreen();" id="fullscreenButton" class="mediaButton fullscreenButton" title="Fullscreen" type="button" data-icon="action" data-iconpos="notext" data-inline="true">Fullscreen</button>'; footerHtml += '<button onclick="MediaPlayer.toggleFullscreen();" id="fullscreenButton" class="mediaButton fullscreenButton" title="Fullscreen" type="button" data-icon="action" data-iconpos="notext" data-inline="true">Fullscreen</button>';
footerHtml += '</div>'; footerHtml += '</div>';