24 lines
654 B
Smalltalk
24 lines
654 B
Smalltalk
Extension { #name : #BrAsyncFileWidget }
|
|
|
|
{ #category : #'*MiniDocs' }
|
|
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 := LeRawYoutubeReferenceInfo fromYoutubeStringUrl: realUrl asString.
|
|
imageUrl := (video rawData at: 'thumbnail_url') asUrl.
|
|
].
|
|
|
|
self stencil: [
|
|
(SkiaImage fromForm:
|
|
(Form fromBase64String: imageUrl retrieveContents base64Encoded))
|
|
asElement constraintsDo: [ :c |
|
|
c horizontal matchParent.
|
|
c vertical matchParent ] ]
|
|
]
|