| 
					
				 | 
			
			
				@@ -2,12 +2,59 @@ import React, { Component } from 'react'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import './index.less'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import videojs from 'video.js'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import Assets from '@src/components/Assets'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { generateUUID } from '@src/services/Tools'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function fullScreen(id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const element = document.getElementById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (element.requestFullscreen) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    element.requestFullscreen(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } else if (element.msRequestFullscreen) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    element.msRequestFullscreen(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } else if (element.mozRequestFullScreen) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    element.mozRequestFullScreen(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } else if (element.webkitRequestFullscreen) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    element.webkitRequestFullscreen(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function exitFullscreen() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (document.exitFullscreen) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    document.exitFullscreen(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } else if (document.msExitFullscreen) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    document.msExitFullscreen(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } else if (document.mozCancelFullScreen) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    document.mozCancelFullScreen(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } else if (document.webkitExitFullscreen) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    document.webkitExitFullscreen(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+let fullAgent = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+document.addEventListener('fullscreenchange', () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (fullAgent) fullAgent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* Firefox */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+document.addEventListener('mozfullscreenchange', () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (fullAgent) fullAgent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* Chrome, Safari and Opera */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+document.addEventListener('webkitfullscreenchange', () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (fullAgent) fullAgent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* IE / Edge */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+document.addEventListener('msfullscreenchange', () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (fullAgent) fullAgent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default class Video extends Component { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   constructor(props) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     super(props); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.ready = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.state = { playing: false, fulling: false }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.state = { id: generateUUID(8), playing: false, fulling: false }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   componentDidMount() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -50,11 +97,25 @@ export default class Video extends Component { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.player.playbackRate(speed); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  onFullChange() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.setState({ fulling: !this.state.fulling }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (this.props.onFullChange) this.props.onFullChange(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  onFull() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fullAgent = () => this.onFullChange(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fullScreen(this.state.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  onExitFull() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    exitFullscreen(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   render() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const { action = true, btnList = [], onAction } = this.props; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const { playing, fulling } = this.state; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const { action = true, btnList = [], children, onAction } = this.props; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const { playing, fulling, id } = this.state; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <div className={`video-item ${action ? 'action' : ''}`}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <div id={id} className={`video-item ${action ? 'action' : ''} ${fulling ? 'full' : ''}`}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <div className="video-wrapper"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <video 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ref={node => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -77,11 +138,21 @@ export default class Video extends Component { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               <div className="flex-block" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               {btnList.map(btn => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (btn.full && !fulling) return ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   <div className="d-i-b m-r-1"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    <div className="btn" onClick={() => onAction && onAction(btn.key)}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                      {btn.title} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    {btn.render ? ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      <div className="fix-btn d-i-b" onClick={() => onAction && onAction(btn.key)}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        {btn.render(btn.active)} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ) : ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      <div 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        className={`btn ${btn.active ? 'active' : ''}`} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        onClick={() => onAction && onAction(btn.key)} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        {btn.title} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    )} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               })} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -89,12 +160,13 @@ export default class Video extends Component { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 <div className="btn">倍速</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               <div className="d-i-b"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                {!fulling && <Assets name="full2" />} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                {fulling && <Assets name="reduction2" />} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {!fulling && <Assets name="full2" onClick={() => this.onFull()} />} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {fulling && <Assets name="reduction2" onClick={() => this.onExitFull()} />} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           )} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        {children} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 |