From efbe655c785655aec3757a8f033bcf62dc0b9b2e Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 7 Jan 2023 18:51:26 -0500 Subject: [PATCH] Image links show a video Thumbnail, similar to what happens in Markdeep. --- .../BaselineOfVideoWeb.class.st | 2 +- app/VideoWeb/BrAsyncFileWidget.extension.st | 23 +++++++++++++++++++ app/VideoWeb/VideoChannel.class.st | 3 ++- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 app/VideoWeb/BrAsyncFileWidget.extension.st diff --git a/app/BaselineOfVideoWeb/BaselineOfVideoWeb.class.st b/app/BaselineOfVideoWeb/BaselineOfVideoWeb.class.st index 615a2dd..d6766bc 100644 --- a/app/BaselineOfVideoWeb/BaselineOfVideoWeb.class.st +++ b/app/BaselineOfVideoWeb/BaselineOfVideoWeb.class.st @@ -16,5 +16,5 @@ BaselineOfVideoWeb >> baseline: spec [ { #category : #accessing } BaselineOfVideoWeb >> semanticVersion [ - ^ '0.3.0' + ^ '0.4.0' ] diff --git a/app/VideoWeb/BrAsyncFileWidget.extension.st b/app/VideoWeb/BrAsyncFileWidget.extension.st new file mode 100644 index 0000000..554b1bd --- /dev/null +++ b/app/VideoWeb/BrAsyncFileWidget.extension.st @@ -0,0 +1,23 @@ +Extension { #name : #BrAsyncFileWidget } + +{ #category : #'*VideoWeb' } +BrAsyncFileWidget >> url: aUrl [ + + | realUrl imageUrl | + realUrl := aUrl asZnUrl. + + realUrl scheme = #file ifTrue: [ + ^ self file: realUrl asFileReference ]. + imageUrl := realUrl. + realUrl host = 'www.youtube.com' ifTrue: [ | video | + video := Invidious defaultInstance video: (realUrl queryAt: 'v'). + imageUrl := video defaultThumbnailLink asUrl. + ]. + + self stencil: [ + (SkiaImage fromForm: + (Form fromBase64String: imageUrl retrieveContents base64Encoded)) + asElement constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ] ] +] diff --git a/app/VideoWeb/VideoChannel.class.st b/app/VideoWeb/VideoChannel.class.st index cbc16d4..4d09611 100644 --- a/app/VideoWeb/VideoChannel.class.st +++ b/app/VideoWeb/VideoChannel.class.st @@ -10,7 +10,8 @@ Class { 'description', 'subscribersCount', 'totalViews', - 'isFamilyFriendly' + 'isFamilyFriendly', + 'latestVideos' ], #category : #VideoWeb }