/** * Created by zack on 2018/4/19. */ import { View, Text, Image, StyleSheet, TouchableHighlight, ImageBackground } from 'react-native' import React, { Component } from 'react' import ScreenDimensions from '../../../utils/ScreenDimensions' import ScreenDimensionsClientHeight from '../../../utils/ScreenDimensions' import NavigationBarHeight from '../../../utils/NavigationBarHeight' import TabBarHeight from '../../../utils/TabBarHeight' import RefreshInfiniteListView from '../../../utils/RefreshInfiniteListView' import Video from 'react-native-video' import ShortVideoProgressView from "./ShortVideoProgressView" import ShortVideoEndView from "./ShortVideoEndView" //ScreenDimensions.clientHeight export default class VideoDetailsCellViewContorller extends Component { constructor(props) { super(props) this.state = { showMp: true, rate: false,//播放数据 showBtn: true,//进入 显示播放 按钮 endBoolPlay: true, paused:false,//是否重新播放 } } componentDidMount() { } componentWillReceiveProps(nextProps) { if (nextProps.selectedPages != this.props.selectedPages) { this.setState({ rate: nextProps.selectedPages }) } } render() { let playIcon = require('../../../resources/images/TabBar/Community/ShortVideo/play.png'); let bottomBackground = require('../../../resources/images/TabBar/Community/ShortVideo/bg_01.png'); let likeIcon = require('../../../resources/images/TabBar/Community/ShortVideo/like.png'); let messIcon = require('../../../resources/images/TabBar/Community/ShortVideo/mess.png'); let moreIcon = require('../../../resources/images/TabBar/Community/ShortVideo/more.png'); let userIcon = require('../../../resources/images/TabBar/Community/ShortVideo/user1.png'); let followIcon = require('../../../resources/images/TabBar/Community/ShortVideo/follow.png'); let suspendedIcon = require('../../../resources/images/TabBar/Community/ShortVideo/suspend.png'); return ( ); } //------------------- onPresslike() { //点赞 } onPressForMess() { //评论 } onPressShare() { //分享 } callfullScreen() { //全屏 this.video.presentFullscreenPlayer() } loadStart() { //需要 添加背景图片 console.log("loadStart=======") } onProgress(time) { if (!this.state.paused&&this.state.rate) { let progressValue = time.currentTime / time.seekableDuration this.progressView.setProgressValue(progressValue, time.currentTime) } } onEnd() { this.setState({ endBoolPlay: false, paused:true }) } onError() { console.log("onError=======") } onAudioBecomingNoisy() { } onAudioFocusChanged() { } onLoad() { console.log("当视频加载完毕时的回调函数") this.setState({ showMp: false }) } videoError() { } onPressInput() { this.refs.chatInputBar.openInputBar(); } _onSendMsg(text) { } onBuffer() { } onPressPlay() { //暂停 播放 let rate = this.state.rate; let showBtn = this.state.showBtn; this.setState({ rate: !rate, showBtn: false }) } //播放完成 分享按钮事件 onPressChat() { } onPressChatFirend() { } onPressQQ() { } onPressSina() { } replay() { this.setState({ paused: false, endBoolPlay: true, }) } } const styles = StyleSheet.create({ View: { width: ScreenDimensions.width, height: ScreenDimensions.height, }, fullScreen: { width: ScreenDimensions.width, height: 195, }, loadingStyle: { position: 'absolute', top: -ScreenDimensions.height, left: 0, bottom: 0, right: 0, }, aboveStyle: { marginTop: -195, // backgroundColor:"yellow" }, topVideo: { width: ScreenDimensions.width, height: 100, // opacity: 0, // justifyContent: "center", paddingTop: 50, alignItems: "center" }, playStyle: { width: 40, height: 40 }, suspendedStyle: { width: 30, height: 30, }, userViewStyle: { width: ScreenDimensions.width, height: 195 - 150 + 50, justifyContent: "space-between" }, // 播放中 与 播放时 的 style bottomStyle: { // justifyContent: "space-between", flexDirection: "row", marginBottom: 10, height: 95, paddingTop: 30, }, bottomLeftStyle: { // flex: 1, alignItems: "center", flexDirection: "row", }, nameStyle: { fontSize: 14, color: "#ffffff", marginLeft: 15 }, headImage: { flexDirection: "row" }, userIcon: { width: 40, height: 40, }, headStyle: { width: 42, height: 42, borderRadius: 42, justifyContent: "center", alignItems: "center", backgroundColor: "#ffffff", marginLeft: 11, }, followStyle: { width: 12, height: 12, marginTop: 30, marginLeft: -15 }, bottomRightStyle: { // flex: 1, alignItems: "flex-end", justifyContent: "center" }, textView: { backgroundColor: "gray", borderRadius: 10, width: 60, height: 20, justifyContent: "center", alignItems: "center", marginRight: 12 }, toolStyle: { width: ScreenDimensions.width, height: 58, backgroundColor: "#ffffff", flexDirection: "row" }, leftToolStyle: { flex: 1, paddingTop: 16, // justifyContent:"center", alignItems: "center" }, rightToolStyle: { flex: 1, flexDirection: "row", alignItems: "center", // paddingTop: 16, justifyContent: "flex-end" }, toolTextStyle: { fontSize: 18, color: "#000000", marginHorizontal: 12 }, likeIcon: { width: 38 / 2, height: 35 / 2 }, textStyle: { marginHorizontal: 10 }, messIcon: { width: 38 / 2, height: 38 / 2 }, moreIcon: { width: 31 / 2, height: 6 / 2, marginRight: 12 }, childrenView: { alignItems: "center", flexDirection: "row" }, playBeforeStyle: { justifyContent: "space-between", flexDirection: "row", width: ScreenDimensions.width, }, })