No Description

VideoDetailsCellViewContorller.js 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /**
  2. * Created by zack on 2018/4/19.
  3. */
  4. import {
  5. View,
  6. Text,
  7. Image,
  8. StyleSheet,
  9. TouchableHighlight,
  10. ImageBackground
  11. } from 'react-native'
  12. import React, { Component } from 'react'
  13. import ScreenDimensions from '../../../utils/ScreenDimensions'
  14. import ScreenDimensionsClientHeight from '../../../utils/ScreenDimensions'
  15. import NavigationBarHeight from '../../../utils/NavigationBarHeight'
  16. import TabBarHeight from '../../../utils/TabBarHeight'
  17. import RefreshInfiniteListView from '../../../utils/RefreshInfiniteListView'
  18. import Video from 'react-native-video'
  19. import BottomView from "./BottomView"
  20. import ChatInputBar from './CustomKeyboard/ChatInputBar';
  21. import RichTextWrapper from './CustomKeyboard/RichTextWrapper';
  22. //ScreenDimensions.clientHeight
  23. export default class VideoDetailsCellViewContorller extends Component {
  24. constructor(props) {
  25. super(props)
  26. this.state = {
  27. rate: 1,
  28. showMp: true,
  29. rate:this.props.selectedPages
  30. }
  31. }
  32. componentDidMount() {
  33. }
  34. componentWillReceiveProps(nextProps) {
  35. if(nextProps.selectedPages != this.props.selectedPages){
  36. this.setState({
  37. rate:nextProps.selectedPages
  38. })
  39. }
  40. }
  41. render() {
  42. return (
  43. <View
  44. style={styles.View}>
  45. <Video ref={(ref) => {
  46. this.video = ref
  47. }}
  48. source={require('../../../resources/MP4/1.mp4')}
  49. style={styles.fullScreen}
  50. rate={this.state.rate?1:0} // 控制暂停/播放,0 代表暂停paused, 1代表播放normal.
  51. paused={false}
  52. volume={1} // 声音的放大倍数,0 代表没有声音,就是静音muted, 1 代表正常音量 normal,更大的数字表示放大的倍数
  53. muted={true} // true代表静音,默认为false.
  54. resizeMode='cover' // 视频的自适应伸缩铺放行为,
  55. onLoad={this.onLoad.bind(this)} // 当视频加载完毕时的回调函数
  56. onLoadStart={this.loadStart.bind(this)} // 当视频开始加载时的回调函数
  57. onProgress={this.onProgress.bind(this)} // 进度控制,每250ms调用一次,以获取视频播放的进度
  58. onEnd={this.onEnd.bind(this)} // 当视频播放完毕后的回调函数
  59. onError={this.videoError.bind(this)} // 当视频不能加载,或出错后的回调函数
  60. onAudioBecomingNoisy={this.onAudioBecomingNoisy.bind(this)}
  61. onAudioFocusChanged={this.onAudioFocusChanged.bind(this)}
  62. repeat={true} // 是否重复播放
  63. />
  64. {this.state.showMp ? <View style={styles.fullScreen}>
  65. <Image source={require('../../../resources/images/TabBar/Community/SmallVideo/VideoDetails/bg.png')} style={styles.loadingStyle} />
  66. </View> : undefined}
  67. <BottomView style={styles.bottomView} onPressInput={this.onPressInput.bind(this)}/>
  68. <ChatInputBar ref="chatInputBar" isVisible={true} onSend={(text) => this._onSendMsg(text)}/>
  69. </View>
  70. );
  71. }
  72. loadStart() {
  73. //需要 添加背景图片
  74. console.log("loadStart=======")
  75. }
  76. onProgress() {
  77. }
  78. onEnd() {
  79. }
  80. onError() {
  81. console.log("onError=======")
  82. }
  83. onAudioBecomingNoisy() {
  84. }
  85. onAudioFocusChanged() {
  86. }
  87. onLoad() {
  88. console.log("当视频加载完毕时的回调函数")
  89. this.setState({
  90. showMp: false
  91. })
  92. }
  93. videoError() {
  94. }
  95. onPressInput(){
  96. console.log("text-========")
  97. this.refs.chatInputBar.openInputBar();
  98. }
  99. _onSendMsg(text){
  100. console.log("text-========",text)
  101. }
  102. }
  103. const styles = StyleSheet.create({
  104. View: {
  105. width: ScreenDimensions.width,
  106. height: ScreenDimensions.height,
  107. backgroundColor:"yellow"
  108. },
  109. fullScreen: {
  110. width: ScreenDimensions.width,
  111. height: ScreenDimensions.height,
  112. },
  113. loadingStyle: {
  114. position: 'absolute',
  115. top: -ScreenDimensions.height,
  116. left: 0,
  117. bottom: 0,
  118. right: 0,
  119. },
  120. btn_backStyle:{
  121. width:25/2,
  122. height:49/2,
  123. marginLeft:21,
  124. marginTop:22
  125. },
  126. topStyle:{
  127. position: 'absolute',
  128. top:0,
  129. left:0,
  130. right:0,
  131. height:88,
  132. backgroundColor:'rgba(255,255,255,.1)',
  133. justifyContent: "space-between",
  134. flexDirection: "row",
  135. },
  136. cellLeftStyle:{
  137. },
  138. cellRightStyle:{
  139. },
  140. bottomView:{
  141. position: 'absolute',
  142. top: ScreenDimensions.height/2,
  143. left: 0,
  144. right: 0,
  145. backgroundColor:"yellow",
  146. width:ScreenDimensions.width,
  147. height:ScreenDimensions.height/2,
  148. }
  149. })