2 Star 9 Fork 4

十万个为什么/react-native-vlc-player

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

[TOC]

react-native-yz-vlcplayer

A <VLCPlayer> component for react-native
此项目 参考react-native-videoreact-native-vlcplayer, react-native-vlc-player

VLCPlayer 支持各种格式(mp4,m3u8,flv,mov,rtsp,rtmp,etc.),具体参看vlc wiki

Add it to your project

Run npm install react-native-yz-vlcplayer --save

android

android vlc-sdk 库来源:https://github.com/mengzhidaren/Vlc-sdk-lib

Run react-native link react-native-yz-vlcplayer

ios

整合 react-native-vlcplayer 而来。

Run react-native link react-native-yz-vlcplayer

1.安装MobileVLCKit.framework

(1)在nightlies.videolan.org/build/iOS/ 下载最新版,

(2)在你的项目目录下新建一个 vlcKit 文件夹,并将MobileVLCKit.framework解压到该目录下

(3)在你的工程里面引入MobileVLCKit.framework

(4)添加 framework search path $(PROJECT_DIR)/../vlcKit

(5)Enable Bitcode 设置为no

Build Settings ---> 查询 Bitcode

(6)设置工程deployment target 为 9.3

FullScreen

需要用到 npm install react-native-orientation --save ,工程配置参看https://github.com/yamill/react-native-orientation

Static Methods

seek(seconds)

this.vlcplayer.seek(100); //单位是 ms
this.vlcPlayer.resume(autoplay) //重新加载视屏进行播放,autopaly: true 表示播放 false表示暂停

Examples

   import { VLCPlayer, VlCPlayerView } from 'react-native-yz-vlcplayer';
   import Orientation from 'react-native-orientation';
   
   //插件参数说明
   (1) 静态方法
       this.vlcplayer.seek(100); //调整播放进度,单位是ms
  (2)
       <VLCPlayer
           ref={ref => (this.vlcPlayer = ref)}
           style={[styles.video]}
           /**
            *  增加视屏宽高比,视屏将按照这个比率拉伸
            */
           videoAspectRatio="16:9"
           /**
            *  是否暂停播放
            */
           paused={this.state.paused}
           /**
            *  资源路径
            *  暂不支持本地资源
            */
           source={{ uri: this.props.uri}}
           /**
            *  进度   
            *  返回 {currentTime:1000,duration:1000} 
            *  单位是 ms
            *  currentTime: 当前时间  
            *  duration:    总时间  
            */
           onProgress={this.onProgress.bind(this)}
           /**
            *  视屏播放结束
            */
           onEnd={this.onEnded.bind(this)}
           /**
            * 正在缓存中
            */
           onBuffering={this.onBuffering.bind(this)}
           onError={this._onError}
           /**
            * 视屏停止
            */
           onStopped={this.onStopped.bind(this)}   
           /**
            * 视屏播放
            */
           onPlaying={this.onPlaying.bind(this)}   
           /**
            * 视屏暂停
            */
           onPaused={this.onPaused.bind(this)}      
       />
   (3)简单例子
       <VlCPlayerView
           autoplay={false}               //视屏播放结束时调用this.vlcPlayer.resume(false)方法
           url={this.state.url}           //视屏url
           Orientation={Orientation}      
           //BackHandle={BackHandle}
           ggUrl=""                      // 广告url
           showGG={true}                 // 是否显示广告
           showTitle={true}              // 是否显示标题
           title=""                      // 标题
           showBack={true}               // 是否显示返回按钮
           onLeftPress={()=>{}}          // 返回按钮点击事件
           startFullScreen={() => {      
              this.setState({
              isFull: true,
             });
           }}
           closeFullScreen={() => {
              this.setState({
              isFull: false,
             });
           }}
       />

MIT Licensed

MIT License Copyright (c) 2016 Brent Vatne, Baris Sencan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

VLC Player for react-native 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/baOZe/react-native-vlc-player.git
git@gitee.com:baOZe/react-native-vlc-player.git
baOZe
react-native-vlc-player
react-native-vlc-player
master

搜索帮助