1.2.6 • Published 6 years ago

react-native-sf-video v1.2.6

Weekly downloads
2
License
ISC
Repository
-
Last release
6 years ago

react-native-sf-video

视频播放、支持全屏,自定义大小,进度显示,设备旋转

show

安装

  • npm install react-native-sf-video
  • npm install react-native-video
  • npm install react-native-sf-net
  • react-native link react-native-sf-video
  • react-native link react-native-video
  • npm install react-native-extra-dimensions-android
  • react-native link react-native-extra-dimensions-android

Props

parametertyperequireddescriptiondefault
titlestringno视频标题,全屏时才会显示null
allOrientationboolnoapp是否支持所有旋转false
autoPlayboolno是否自动播放true
resizeModestringno视频内容适配方式('content', 'cover','stretch')'cover'
widthnumberno视频宽度屏幕宽度
heightnumberno视频高度屏幕高度
leftnumberno靠左距离0
topnumberno靠上距离0
barHeightnumberno进度栏的高度35
hideDurationnumberno进度栏消失的时间(单位毫秒)3000
progressColorstringno进度栏中进度条颜色'white'
progressMinColorstringno进度栏隐藏时底部进度条颜色'rgba(241,90,36,1.0)'
containerBackgroundColorstringno视屏背景颜色'black'
videoSizenumberno视频大小(MB为单位),在非wifi下会显示null
onFullScreenfuncno全屏时回调null
onMinScreenfuncno小屏时的回调null
onEndfuncno视频播放完成时回调null
videoFullSourcenumberno视屏全屏按钮图片null
videoMinSourcenumberno视屏小屏按钮图片null
videoPlaySourcenumberno视屏播放按钮图片null
videoPauseSourcenumberno视屏暂停按钮图片null

例子

使用前需要调用SFNet.registNetListener();来监听网络状态

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View,
    Dimensions,
    StatusBar
} from 'react-native';

import SFVideoView from "react-native-sf-video"
var dw = Dimensions.get('window').width;
var dh = Dimensions.get('window').height;
export default class App extends Component {
  constructor(proprs){
    super(proprs);
    this.state={
      source:''
    }
  }
  componentDidMount(){

  }
  render_text = () => {
    items = [];
    for (var i = 0; i < 15; i++){
      var str = '';
      for (var j = 0; j < i+1; j++){
        str += '文章标题'
      }
      items.push(
          <Text key={i} style={{
            color:'rgba(90,90,90,1)',
            fontSize:15,
            marginTop:10
          }}>{str}</Text>
      )
    }
    return items;
  }
  render() {
    return (
      <View style={styles.container}>
        <StatusBar barStyle="light-content" translucent={true}/>
        <SFVideoView
            source={'http://video.pearvideo.com/mp4/short/20170519/cont-1082017-10470584-sd.mp4'}
            title={'视频标题'}
            left={0} top={0} width={dw} autoPlay={true} height={233}/>
        <View style={{
          flex:1
        }}>
          {this.render_text()}
        </View>

      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F5FCFF',
  },
1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.9

6 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago