@@ -66,8 +66,12 @@ function shouldResetPlayer(prevProps, props) {
66
66
* @param {Object } props
67
67
*/
68
68
function shouldUpdatePlayer ( prevProps , props ) {
69
- return prevProps . id !== props . id || prevProps . className !== props . className
70
- || prevProps . opts . width !== props . opts . width || prevProps . opts . height !== props . opts . height ;
69
+ return (
70
+ prevProps . id !== props . id ||
71
+ prevProps . className !== props . className ||
72
+ prevProps . opts . width !== props . opts . width ||
73
+ prevProps . opts . height !== props . opts . height
74
+ ) ;
71
75
}
72
76
73
77
class YouTube extends React . Component {
@@ -274,7 +278,7 @@ class YouTube extends React.Component {
274
278
render ( ) {
275
279
return (
276
280
< div className = { this . props . containerClassName } >
277
- < div id = { this . props . id } className = { this . props . className } ref = { this . refContainer } />
281
+ < div id = { this . props . id } className = { this . props . className } ref = { this . refContainer } loading = { this . props . loading } />
278
282
</ div >
279
283
) ;
280
284
}
@@ -291,6 +295,9 @@ YouTube.propTypes = {
291
295
// custom class name for player container element
292
296
containerClassName : PropTypes . string ,
293
297
298
+ // custom loading for player element
299
+ loading : PropTypes . oneOf ( [ 'lazy' , 'eager' , 'auto' ] ) ,
300
+
294
301
// https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player
295
302
opts : PropTypes . objectOf ( PropTypes . any ) ,
296
303
@@ -309,6 +316,7 @@ YouTube.defaultProps = {
309
316
videoId : null ,
310
317
id : null ,
311
318
className : null ,
319
+ loading : null ,
312
320
opts : { } ,
313
321
containerClassName : '' ,
314
322
onReady : ( ) => { } ,
0 commit comments