npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-vlcplayer

v0.1.2

Published

A <VLCPlayer /> element for react-native,For Mobile

Downloads

22

Readme

react-native-vlcplayer

A <VLCPlayer> component for react-native
此项目 参考react-native-video,但是有很多mp4 ios的硬解码无法播放,所以诞生了这个项目,这是一个足够简单的封装,全功能播放器的控制条留给自己去实现,同时可以参考移动播放器的例子。

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

播放器例子 全屏模式

Add it to your project

Run npm install react-native-vlcplayer --save

iOS

  • Install rnpm and run rnpm link react-native-vlcplayer

  • 安装MobileVLCKit.framework,在nightlies.videolan.org/build/ios/ 下载最新版,解压后在你的工程里面引入MobileVLCKit.framework,并且添加 framework search path

Usage

这是一个极其简单的VLC播放器,默认是不带控制条和进度条,但是完全可以通过回调实现自己需要的样式的播放器,参看例子Examples vlcplayer,包括一个简单播放器和一个全功能播放器。

<VLCPlayer
    ref='vlcplayer'
    paused={this.state.paused}  //通过paused设置player play or pause的状态
    style={styles.vlcplayer}
    source={{uri:this.props.uri,initOptions:['--codec=avcodec']}} 
    onProgress={this.onProgress.bind(this)} //进度回调
    onEnded={this.onEnded.bind(this)} //结束回调,一般使用stopped即可
    onStopped={this.onEnded.bind(this)} //停止回调
    onPlaying={this.onPlaying.bind(this)} //开始播放回调
    onBuffering={this.onBuffering.bind(this)} //正在缓冲回调
    onPaused={this.onPaused.bind(this)} //暂停回调
 />
 

//source.uri,可以是vlc支持的串流,或者普通的url,source.initOptions VLC支持的初始化选项 ,See vlc 命令行参数

FullScreen

需要用到 npm install react-native-orientation --save ,工程配置参看https://github.com/yamill/react-native-orientation
具体使用方法,参看vlcplayer/Video.js

Static Methods

seek(seconds)

this.refs['vlcplayer'].seek(0.333); //单位是 0~1 的百分比

snapshot(path)

this.refs['vlcplayer'].snapshot(path); //保存截图

Examples

可以根据自己的情况使用下面的例子,自己DIY播放器

  • <SimpleVideo /> 一个简单的播放器
  • <Video /> 一个全功能的播放器
import React, { Component } from 'react';
import {
 AppRegistry,
 View,
 Text
} from 'react-native';
import SimpleVideo  from './SimpleVideo.js';
import Video  from './Video.js';



class vlcplayer extends Component {

  render() {
    const uri = 'http://cdn.goluk.cn/video/t1_2.mp4';
    return (
      <View>
      <SimpleVideo uri={uri} buttonSize={50} />
      <Text>A Simple Player</Text>
      <View style={{marginTop:50}} />
      <Video uri={uri} />
      <Text>A full-featured player</Text>
      </View>
    );
  }
}

AppRegistry.registerComponent('vlcplayer', () => vlcplayer);

TODOS

  • [ ] Add support for Android
  • [x] Add support for snapshot
  • [ ] Add support for record
  • [x] Add support for A full-featured player

加入ReactNative讨论组

###QQ群:316434159 ### 扫描加入


MIT Licensed