Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 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 @@ -105,6 +105,7 @@ export default defineComponent({
hideViews: false,
addToPlaylistPromptCloseCallback: null,
debounceGetDeArrowThumbnail: null,
thumbnailLoaded: false,
}
},
computed: {
Expand Down Expand Up @@ -857,6 +858,10 @@ export default defineComponent({
showToast(this.$t('Video.Video has been removed from your saved list'))
},

onThumbnailLoad() {
this.thumbnailLoaded = true
},

...mapActions([
'openInExternalPlayer',
'updateHistory',
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/components/ft-list-video/ft-list-video.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
.thumbnailLink:hover {
outline: 3px solid var(--side-nav-hover-color);
}

.thumbnailImage.thumbnailLoading {
// Makes img element sized correctly before image loading starts
aspect-ratio: 16 / 9;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the aspect-ratio docs on MDN, you can do this for images, which will make it use 16/9 until the image is downloaded and after that use the image's aspect ratio.

That would allow you to remove the javascript and the thumbnail loading class.

Suggested change
aspect-ratio: 16 / 9;
aspect-ratio: 16/9 auto;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it's done

}
4 changes: 4 additions & 0 deletions src/renderer/components/ft-list-video/ft-list-video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
<img
:src="thumbnail"
class="thumbnailImage"
:class="{
thumbnailLoading: !thumbnailLoaded,
}"
alt=""
:style="{filter: blurThumbnailsStyle}"
@load="onThumbnailLoad"
>
</router-link>
<div
Expand Down