forked from SolidOS/solid-panes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideoPane.js
More file actions
34 lines (29 loc) · 862 Bytes
/
videoPane.js
File metadata and controls
34 lines (29 loc) · 862 Bytes
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
/* Single video play Pane
**
*/
import * as UI from 'solid-ui'
import * as $rdf from 'rdflib'
export default {
icon: UI.icons.iconBase + 'noun_1619.svg',
name: 'video',
// Does the subject deserve an slideshow pane?
label: function (subject, context) {
const kb = context.session.store
const typeURIs = kb.findTypeURIs(subject)
const prefix = $rdf.Util.mediaTypeClass('video/*').uri.split('*')[0]
for (const t in typeURIs) {
if (t.startsWith(prefix)) return 'Play video'
}
return null
},
render: function (subject, context) {
const dom = context.dom
const div = dom.createElement('div')
const video = div.appendChild(dom.createElement('video'))
video.setAttribute('controls', 'yes')
video.setAttribute('src', subject.uri)
video.setAttribute('width', '100%')
return div
}
}
// ends