Image links show a video Thumbnail, similar to what happens in Markdeep.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-01-07 18:51:26 -05:00
parent c6a51d3896
commit efbe655c78
3 changed files with 26 additions and 2 deletions

View File

@ -16,5 +16,5 @@ BaselineOfVideoWeb >> baseline: spec [
{ #category : #accessing }
BaselineOfVideoWeb >> semanticVersion [
^ '0.3.0'
^ '0.4.0'
]

View File

@ -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 ] ]
]

View File

@ -10,7 +10,8 @@ Class {
'description',
'subscribersCount',
'totalViews',
'isFamilyFriendly'
'isFamilyFriendly',
'latestVideos'
],
#category : #VideoWeb
}