Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for switching to embedded players #6662

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/renderer/components/player-settings/player-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,18 @@ export default defineComponent({
}
}

viewingModeNames.push(
this.$t('Settings.Player Settings.Default Viewing Mode.Invidious Embed'),
this.$t('Settings.Player Settings.Default Viewing Mode.YouTube Embed')
)
return viewingModeNames
},

viewingModeValues: function () {
const viewingModeValues = [
'default',
'theatre',
'fullwindow'
'fullwindow',
]

if (process.env.IS_ELECTRON) {
Expand All @@ -230,6 +234,8 @@ export default defineComponent({
}
}

viewingModeValues.push('ivembed', 'ytembed')

return viewingModeValues
},

Expand Down
14 changes: 14 additions & 0 deletions src/renderer/views/Watch/Watch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,17 @@
}
}
}


.ytIframe {
position: relative;
padding-block-start: 56%;

iframe {
position: absolute;
inset-block-start: 0;
inset-inline-start: 0;
inline-size: 100%;
block-size: 100%;
}
}
20 changes: 19 additions & 1 deletion src/renderer/views/Watch/Watch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
>
<div class="videoAreaMargin">
<ft-shaka-video-player
v-if="!isLoading && !isUpcoming && !errorMessage"
v-if="!isLoading && !isUpcoming && !errorMessage && defaultViewingMode !== 'ivembed' && defaultViewingMode != 'ytembed'"
ref="player"
:manifest-src="manifestSrc"
:manifest-mime-type="manifestMimeType"
Expand Down Expand Up @@ -49,6 +49,24 @@
@toggle-autoplay="toggleAutoplay"
@playback-rate-updated="updatePlaybackRate"
/>
<div
v-if="defaultViewingMode === 'ivembed' || defaultViewingMode === 'ytembed'"
class="ytIframe"
>
<iframe
class="player"
width="100%"
height="auto"
:src="defaultViewingMode === 'ytembed' ? `https://www.youtube.com/embed/${videoId}` : `${currentInvidiousInstanceUrl}/embed/${videoId}`"
frameborder="0"
:title="'YouTube video player'"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="no-referrer"
allowfullscreen
credentialless
sandbox="allow-same-origin allow-scripts"
/>
</div>
<div
v-if="!isLoading && (isUpcoming || errorMessage)"
class="videoPlayer"
Expand Down
2 changes: 2 additions & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ Settings:
Full Screen: Full Screen
Picture in Picture: Picture in Picture
External Player: External Player ({externalPlayerName})
Invidious Embed: Invidious Embed (not recommended)
YouTube Embed: YouTube Embed (not recommended)
Scroll Volume Over Video Player: Scroll Volume Over Video Player
Scroll Playback Rate Over Video Player: Scroll Playback Rate Over Video Player
Skip by Scrolling Over Video Player: Skip by Scrolling Over Video Player
Expand Down
Loading