Moving functionality from VideoWeb.
This commit is contained in:
parent
2f3fa9a4d3
commit
84591efdcc
23
src/MiniDocs/BrAsyncFileWidget.extension.st
Normal file
23
src/MiniDocs/BrAsyncFileWidget.extension.st
Normal file
@ -0,0 +1,23 @@
|
||||
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 ] ]
|
||||
]
|
Loading…
Reference in New Issue
Block a user