mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add initial AirPlay support (#659)
This commit is contained in:
parent
86bf6ab8d2
commit
21066f06f0
4 changed files with 53 additions and 0 deletions
|
@ -1523,6 +1523,10 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (browser.safari || browser.iOS || browser.iPad) {
|
||||||
|
list.push('AirPlay')
|
||||||
|
}
|
||||||
|
|
||||||
list.push('SetBrightness');
|
list.push('SetBrightness');
|
||||||
list.push("SetAspectRatio")
|
list.push("SetAspectRatio")
|
||||||
|
|
||||||
|
@ -1631,6 +1635,31 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HtmlVideoPlayer.prototype.isAirPlayEnabled = function () {
|
||||||
|
|
||||||
|
if (document.AirPlayEnabled) {
|
||||||
|
return document.AirplayElement ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
HtmlVideoPlayer.prototype.setAirPlayEnabled = function (isEnabled) {
|
||||||
|
var video = this._mediaElement;
|
||||||
|
|
||||||
|
if (document.AirPlayEnabled) {
|
||||||
|
if (video) {
|
||||||
|
if (isEnabled) {
|
||||||
|
video.requestAirPlay().catch(onAirPlayError);
|
||||||
|
} else {
|
||||||
|
document.exitAirPLay().catch(onAirPlayError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
video.webkitShowPlaybackTargetPicker();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
HtmlVideoPlayer.prototype.setBrightness = function (val) {
|
HtmlVideoPlayer.prototype.setBrightness = function (val) {
|
||||||
|
|
||||||
var elem = this._mediaElement;
|
var elem = this._mediaElement;
|
||||||
|
@ -1784,6 +1813,10 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
return this.setPictureInPictureEnabled(!this.isPictureInPictureEnabled());
|
return this.setPictureInPictureEnabled(!this.isPictureInPictureEnabled());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HtmlVideoPlayer.prototype.toggleAirPlay = function () {
|
||||||
|
return this.setAirPlayEnabled(!this.isAirPlayEnabled());
|
||||||
|
};
|
||||||
|
|
||||||
HtmlVideoPlayer.prototype.getBufferedRanges = function () {
|
HtmlVideoPlayer.prototype.getBufferedRanges = function () {
|
||||||
var mediaElement = this._mediaElement;
|
var mediaElement = this._mediaElement;
|
||||||
if (mediaElement) {
|
if (mediaElement) {
|
||||||
|
|
|
@ -1540,6 +1540,11 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
||||||
return player.togglePictureInPicture();
|
return player.togglePictureInPicture();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.toggleAirPlay = function (player) {
|
||||||
|
player = player || self._currentPlayer;
|
||||||
|
return player.toggleAirPlay();
|
||||||
|
};
|
||||||
|
|
||||||
self.getSubtitleStreamIndex = function (player) {
|
self.getSubtitleStreamIndex = function (player) {
|
||||||
|
|
||||||
player = player || self._currentPlayer;
|
player = player || self._currentPlayer;
|
||||||
|
@ -3854,6 +3859,9 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
||||||
if (player.supports('PictureInPicture')) {
|
if (player.supports('PictureInPicture')) {
|
||||||
list.push('PictureInPicture');
|
list.push('PictureInPicture');
|
||||||
}
|
}
|
||||||
|
if (player.supports('AirPlay')) {
|
||||||
|
list.push('AirPlay');
|
||||||
|
}
|
||||||
if (player.supports('SetBrightness')) {
|
if (player.supports('SetBrightness')) {
|
||||||
list.push('SetBrightness');
|
list.push('SetBrightness');
|
||||||
}
|
}
|
||||||
|
|
|
@ -789,6 +789,12 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
|
||||||
view.querySelector(".btnPip").classList.remove("hide");
|
view.querySelector(".btnPip").classList.remove("hide");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (-1 === supportedCommands.indexOf("AirPlay")) {
|
||||||
|
view.querySelector(".btnAirPlay").classList.add("hide");
|
||||||
|
} else {
|
||||||
|
view.querySelector(".btnAirPlay").classList.remove("hide");
|
||||||
|
}
|
||||||
|
|
||||||
updateFullscreenIcon();
|
updateFullscreenIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1306,6 +1312,9 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
|
||||||
view.querySelector(".btnPip").addEventListener("click", function () {
|
view.querySelector(".btnPip").addEventListener("click", function () {
|
||||||
playbackManager.togglePictureInPicture(currentPlayer);
|
playbackManager.togglePictureInPicture(currentPlayer);
|
||||||
});
|
});
|
||||||
|
view.querySelector(".btnAirPlay").addEventListener("click", function () {
|
||||||
|
playbackManager.toggleAirPlay(currentPlayer);
|
||||||
|
});
|
||||||
view.querySelector(".btnVideoOsdSettings").addEventListener("click", onSettingsButtonClick);
|
view.querySelector(".btnVideoOsdSettings").addEventListener("click", onSettingsButtonClick);
|
||||||
view.addEventListener("viewhide", function () {
|
view.addEventListener("viewhide", function () {
|
||||||
headerElement.classList.remove("hide");
|
headerElement.classList.remove("hide");
|
||||||
|
|
|
@ -72,6 +72,9 @@
|
||||||
<button is="paper-icon-button-light" class="btnPip hide autoSize" title="${PictureInPicture}">
|
<button is="paper-icon-button-light" class="btnPip hide autoSize" title="${PictureInPicture}">
|
||||||
<i class="xlargePaperIconButton md-icon">picture_in_picture_alt</i>
|
<i class="xlargePaperIconButton md-icon">picture_in_picture_alt</i>
|
||||||
</button>
|
</button>
|
||||||
|
<button is="paper-icon-button-light" class="btnAirPlay hide autoSize" title="${AirPlay}">
|
||||||
|
<i class="xlargePaperIconButton md-icon">airplay</i>
|
||||||
|
</button>
|
||||||
|
|
||||||
<div class="osdTimeText"><span class="osdPositionText"></span><span class="osdDurationText"></span><span class="endsAtText"></span></div>
|
<div class="osdTimeText"><span class="osdPositionText"></span><span class="osdDurationText"></span><span class="endsAtText"></span></div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue