Skip to content

Commit

Permalink
Implement external player default viewing mode
Browse files Browse the repository at this point in the history
Current limitations: does not work for the search bar, randomly encountered YT video links (e.g., in descriptions), or the video thumbnail link in the playlist list view.
  • Loading branch information
kommunarr committed Oct 20, 2024
1 parent e4fc61c commit f67eacd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ export default defineComponent({
'updateHideLiveChat',
'updateHideActiveSubscriptions',
'updatePlayNextVideo',
'updateDefaultViewingMode',
'updateHideVideoDescription',
'updateHideComments',
'updateHideCommentPhotos',
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/components/ft-list-playlist/ft-list-playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export default defineComponent({
return this.$store.getters.getExternalPlayer
},

externalPlayerIsDefaultViewingMode: function () {
return this.$store.getters.getDefaultViewingMode === 'external_player'
},

defaultPlayback: function () {
return this.$store.getters.getDefaultPlayback
},
Expand Down
13 changes: 13 additions & 0 deletions src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ export default defineComponent({
return this.$store.getters.getExternalPlayer
},

externalPlayerIsDefaultViewingMode: function () {
return this.$store.getters.getDefaultViewingMode === 'external_player'
},

defaultPlayback: function () {
return this.$store.getters.getDefaultPlayback
},
Expand Down Expand Up @@ -478,6 +482,10 @@ export default defineComponent({
return this.isInQuickBookmarkPlaylist ? 'base favorite' : 'base'
},

watchPageLinkType() {
return this.externalPlayerIsDefaultViewingMode ? 'a' : 'router-link'
},

watchPageLinkTo() {
// For `router-link` attribute `to`
return {
Expand Down Expand Up @@ -530,6 +538,11 @@ export default defineComponent({
}
},
methods: {
handleWatchPageLinkClick: function() {
if (this.externalPlayerIsDefaultViewingMode) {
this.handleExternalPlayer()
}
},
fetchDeArrowThumbnail: async function() {
if (this.thumbnailPreference === 'hidden') { return }
const videoId = this.id
Expand Down
18 changes: 12 additions & 6 deletions src/renderer/components/ft-list-video/ft-list-video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@
>
<div
class="videoThumbnail"
>
<router-link
>
<component
:is="watchPageLinkType"
class="thumbnailLink"
tabindex="-1"
:to="watchPageLinkTo"
href="javascript:void(0)"
@click="handleWatchPageLinkClick"
>
<img
:src="thumbnail"
class="thumbnailImage"
alt=""
:style="{filter: blurThumbnailsStyle}"
>
</router-link>
</component>
<div
v-if="isLive || isUpcoming || (displayDuration !== '' && displayDuration !== '0:00')"
class="videoDuration"
Expand All @@ -34,7 +37,7 @@
{{ isLive ? $t("Video.Live") : (isUpcoming ? $t("Video.Upcoming") : displayDuration) }}
</div>
<ft-icon-button
v-if="externalPlayer !== ''"
v-if="externalPlayer !== '' && !externalPlayerIsDefaultViewingMode"
:title="$t('Video.External Player.OpenInTemplate', { externalPlayer })"
:icon="['fas', 'external-link-alt']"
class="externalPlayerIcon"
Expand Down Expand Up @@ -110,14 +113,17 @@
/>
</div>
<div class="info">
<router-link
<component
:is="watchPageLinkType"
class="title"
:to="watchPageLinkTo"
href="javascript:void(0)"
@click="handleWatchPageLinkClick"
>
<h3 class="h3Title">
{{ displayTitle }}
</h3>
</router-link>
</component>
<div class="infoLine">
<router-link
v-if="channelId !== null"
Expand Down
1 change: 0 additions & 1 deletion src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ export default defineComponent({
return
case 'pip':
this.startNextVideoInPip = true

}
},

Expand Down

0 comments on commit f67eacd

Please sign in to comment.