diff --git a/src/renderer/assets/img/close_theatre.svg b/src/renderer/assets/img/close_theatre.svg new file mode 100644 index 00000000..220d28e6 --- /dev/null +++ b/src/renderer/assets/img/close_theatre.svg @@ -0,0 +1 @@ + diff --git a/src/renderer/assets/img/open_theatre.svg b/src/renderer/assets/img/open_theatre.svg new file mode 100644 index 00000000..c1e49ac6 --- /dev/null +++ b/src/renderer/assets/img/open_theatre.svg @@ -0,0 +1 @@ + diff --git a/src/renderer/components/ft-video-player/ft-video-player.js b/src/renderer/components/ft-video-player/ft-video-player.js index 662cbd19..09c7e0ff 100644 --- a/src/renderer/components/ft-video-player/ft-video-player.js +++ b/src/renderer/components/ft-video-player/ft-video-player.js @@ -112,6 +112,7 @@ export default Vue.extend({ 'subsCapsButton', 'audioTrackButton', 'pictureInPictureToggle', + 'toggleTheatreModeButton', 'fullWindowButton', 'qualitySelector', 'fullscreenToggle' @@ -164,6 +165,10 @@ export default Vue.extend({ return this.$store.getters.getDefaultVideoFormat }, + defaultTheatreMode: function () { + return this.$store.getters.getDefaultTheatreMode + }, + autoplayVideos: function () { return this.$store.getters.getAutoplayVideos }, @@ -195,6 +200,7 @@ export default Vue.extend({ this.createFullWindowButton() this.createLoopButton() + this.createToggleTheatreModeButton() this.determineFormatType() this.determineMaxFramerate() }, @@ -966,6 +972,45 @@ export default Vue.extend({ videojs.registerComponent('fullWindowButton', fullWindowButton) }, + createToggleTheatreModeButton: function() { + if (!this.$parent.theatrePossible) { + return + } + + const theatreModeActive = this.defaultTheatreModeActive ? ' vjs-icon-theatre-active' : '' + + const VjsButton = videojs.getComponent('Button') + const toggleTheatreModeButton = videojs.extend(VjsButton, { + constructor: function(player, options) { + VjsButton.call(this, player, options) + }, + handleClick: () => { + this.toggleTheatreMode() + }, + createControlTextEl: function (button) { + return $(button) + .addClass('vjs-button-theatre') + .html($(`
`)) + .attr('title', 'Toggle Theatre Mode') + } + }) + + videojs.registerComponent('toggleTheatreModeButton', toggleTheatreModeButton) + }, + + toggleTheatreMode: function() { + if (!this.player.isFullscreen_) { + const toggleTheatreModeButton = $('#toggleTheatreModeButton') + if (!this.$parent.useTheatreMode) { + toggleTheatreModeButton.addClass('vjs-icon-theatre-active') + } else { + toggleTheatreModeButton.removeClass('vjs-icon-theatre-active') + } + } + + this.$parent.toggleTheatreMode() + }, + createDashQualitySelector: function (levels) { if (levels.levels_.length === 0) { setTimeout(() => { diff --git a/src/renderer/components/watch-video-info/watch-video-info.sass b/src/renderer/components/watch-video-info/watch-video-info.sass index 73047fb0..a6e466d1 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.sass +++ b/src/renderer/components/watch-video-info/watch-video-info.sass @@ -86,7 +86,3 @@ ::v-deep .iconDropdown left: calc(50% - 20px) right: auto - - @media only screen and (max-width: 1350px) - .theatreModeButton - display: none diff --git a/src/renderer/components/watch-video-info/watch-video-info.vue b/src/renderer/components/watch-video-info/watch-video-info.vue index 0d7b0bc3..2ea9960d 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.vue +++ b/src/renderer/components/watch-video-info/watch-video-info.vue @@ -78,14 +78,6 @@ theme="secondary" @click="handleExternalPlayer" /> -