-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathYoutube.fusion
119 lines (105 loc) · 4.66 KB
/
Youtube.fusion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
prototype(Jonnitto.PrettyEmbedYoutube:Content.Youtube) < prototype(Jonnitto.PrettyEmbedHelper:Content) {
package = 'Youtube'
metadataID = ${q(node).property('metadataID')}
videoID = ${q(node).property('videoID')}
videoID.@process.getIDFromUrl = ${this.metadataID ? this.metadataID : Jonnitto.PrettyEmbedHelper.youtubeID(value)}
alternativeText = ${q(node).property('metadataTitle')}
imageFromYoutube = ${q(node).property('metadataImage')}
thumbnailFromResources = ${q(node).property('metadataThumbnail')}
ratio = ${q(node).property('metadataRatio')}
maximumWidth = ${Configuration.setting('Jonnitto.PrettyEmbedHelper.maximumWidth')}
async = true
# This can be 'video' or 'playlist'.
type = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'type'
}
# Should the video be opened on a lightbox?
lightbox = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'lightbox'
}
# When the lightbox is set, should the preview image preserve his aspect ratio?
preserveAspectRatio = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'preserveAspectRatio'
}
# If no aspect ratio can be calcualted from the oembed service, you have the possibility to force the aspect ratio 16:9
force16to9 = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'force16to9'
}
# Whether to restart the video automatically after reaching the end.
loop = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'loop'
}
# Whether the video plays inline on supported mobile devices.
# Note that if set to false it does not imply that the video will always be played in fullscreen.
playsinline = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'playsinline'
}
# Allow full screen
allowFullScreen = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'allowFullScreen'
}
# This parameter indicates whether the video player controls are displayed
controls = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'controls'
}
# Setting the parameter's value to true causes closed captions to be shown by default,
# even if the user has turned captions off.
closedCaptions = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'closedCaptions'
}
# It is not possible to disable related videos, but if it is set to false, the player will
# show related videos that are from the same channel as the video that was just played.
showRelated = Jonnitto.PrettyEmbedHelper:GetProperty {
property = 'showRelated'
}
enableGdprMessage = ${Configuration.setting('Jonnitto.PrettyEmbedHelper.enableGdprMessage')}
gdprMessage = Jonnitto.PrettyEmbedHelper:GdprMessage
gdprMessageAccept = Jonnitto.PrettyEmbedHelper:GdprMessageAccept
gdprMessageNewWindow = Jonnitto.PrettyEmbedHelper:GdprMessageNewWindow
renderer = Neos.Fusion:Component {
@apply.props = ${props}
poster = Neos.Fusion:Case {
hasPersisantResource {
condition = ${props.image || props.thumbnailFromResources}
renderer = Neos.Neos:ImageUri {
asset = ${props.image || props.thumbnailFromResources}
async = ${props.async}
maximumWidth = ${props.maximumWidth}
}
}
thumbnailFromYoutube {
condition = ${props.videoID}
renderer = ${props.imageFromYoutube}
}
}
poster2x = Neos.Neos:ImageUri {
@if {
hasAsset = ${this.asset}
hasEnoughPixel = ${this.asset.width >= props.maximumWidth * 2}
}
asset = ${props.image || props.thumbnailFromResources}
async = ${props.async}
maximumWidth = ${props.maximumWidth * 2}
}
renderer = Neos.Fusion:Case {
noVideoID {
condition = ${!props.videoID}
renderer = Jonnitto.PrettyEmbedHelper:Notification {
key = 'noVideoID'
default = 'Please add a Youtube ID or url in the inspector'
}
}
noPoster {
condition = ${!props.poster && props.type == 'playlist'}
renderer = Jonnitto.PrettyEmbedHelper:Notification {
key = 'needPreviewImage'
default = 'You need to define a custom preview image.'
}
}
default {
condition = true
renderer = afx`<Jonnitto.PrettyEmbedYoutube:Component.Youtube {...props} live={node.context.live} />`
}
}
}
}