Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
cb01cb93
Commit
cb01cb93
authored
Nov 16, 2020
by
seotts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use Wistia api to do callback
parent
e14b6d52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
21 deletions
+45
-21
src/components/video/video.jsx
src/components/video/video.jsx
+45
-21
No files found.
src/components/video/video.jsx
View file @
cb01cb93
const
bindAll
=
require
(
'
lodash.bindall
'
);
const
PropTypes
=
require
(
'
prop-types
'
);
const
React
=
require
(
'
react
'
);
const
classNames
=
require
(
'
classnames
'
);
require
(
'
./video.scss
'
);
const
Video
=
props
=>
(
<
div
className=
{
classNames
(
'
video-player
'
,
props
.
className
)
}
>
<
iframe
allowFullScreen
// allowFullScreen is legacy, can we start using allow='fullscreen'?
// allow="fullscreen"
frameBorder=
"0"
// deprecated attribute
height=
{
props
.
height
}
scrolling=
"no"
// deprecated attribute
src=
{
`https://fast.wistia.net/embed/iframe/${props.videoId}?seo=false&videoFoam=true`
}
title=
{
props
.
title
}
width=
{
props
.
width
}
onLoad=
{
props
.
onLoad
}
/>
<
script
async
src=
"https://fast.wistia.net/assets/external/E-v1.js"
/>
</
div
>
);
class
Video
extends
React
.
Component
{
componentDidMount
()
{
/**
uses code snippets from
https://github.com/mrdavidjcole/wistia-player-react/blob/master/src/components/wistia_embed.js
**/
if
(
!
document
.
getElementById
(
'
wistia_script
'
))
{
const
wistiaScript
=
document
.
createElement
(
'
script
'
);
wistiaScript
.
id
=
'
wistia_script
'
;
wistiaScript
.
type
=
'
text/javascript
'
;
wistiaScript
.
src
=
'
https://fast.wistia.com/assets/external/E-v1.js
'
;
wistiaScript
.
async
=
false
;
document
.
body
.
appendChild
(
wistiaScript
);
}
window
.
_wq
=
window
.
_wq
||
[];
window
.
_wq
.
push
({
id
:
this
.
props
.
videoId
,
onReady
:
this
.
props
.
onLoad
});
}
render
()
{
return
(
<
div
className=
{
classNames
(
'
video-player
'
,
this
.
props
.
className
)
}
>
<
iframe
allowFullScreen
// allowFullScreen is legacy, can we start using allow='fullscreen'?
// allow="fullscreen"
className=
{
classNames
(
'
wistia_embed
'
,
`wistia_async_${this.props.videoId}`
)
}
frameBorder=
"0"
// deprecated attribute
height=
{
this
.
props
.
height
}
scrolling=
"no"
// deprecated attribute
src=
{
`https://fast.wistia.net/embed/iframe/${this.props.videoId}?seo=false&videoFoam=true`
}
title=
{
this
.
props
.
title
}
width=
{
this
.
props
.
width
}
// onLoad={this.props.onLoad}
/>
</
div
>
);
}
}
Video
.
defaultProps
=
{
height
:
'
225
'
,
title
:
''
,
...
...
@@ -37,7 +62,6 @@ Video.propTypes = {
title
:
PropTypes
.
string
.
isRequired
,
videoId
:
PropTypes
.
string
.
isRequired
,
width
:
PropTypes
.
string
.
isRequired
};
module
.
exports
=
Video
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment