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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-omplayer

v1.0.87

Published

video player for react-native

Downloads

112

Readme

ios配置

  1. Build Phases-> Link Binary With Libraries中添加libz.tbd
  2. 将react-native-omplayer/ios下的png文件拖到工程中。

参见index.js

使用说明

import { Video, Audio } from 'react-native-omplayer'

// Video参见video.js
// Audio参见audio.js


<Video
	cookie={'111111'}  //设置cookie 用于视频加密 (后端使用user-agent) 其他格式任意字符串
	src="some url"		// 设置url
	controls				// 是否显示自带控件,默认true
	fullscreen			// 是否全屏,默认false
	repeat					// 是否重复,默认false
	paused					// 是否暂停,默认false
	muted					// 是否静音,默认false
	volume					// 音量,0.0-1.0
	rate					// 播放速率,默认1.0,仅ios有效
	currentTime			// 播放位置
	onLoadStart
	onLoad
	onLoadStalled
	onLoadResume
	onError
	onProgress
	onSeek
	onEnd
	onFullscreenPlayerWillPresent
	onFullscreenPlayerDidPresend
	onFullscreenPlayerWillDismiss
	onFullscreenPlayerDidDismiss
	onReadyForDisplay
	onPlaybackStalled
	onPlaybackResume
	onPlaybackRateChange
/>

// 音频
// 构造,传递listener
const audio = new Audio({
	onLoadStart: (evt) => { console.log(evt) },
	onLoad: (evt) => { console.log(evt) },
	onLoadStalled: (evt) => { console.log(evt) },
	onLoadResume: (evt) => { console.log(evt) },
	onError: (evt) => { console.log(evt) },
	onProgress: (evt) => { console.log(evt) },
	onSeek: (evt) => { console.log(evt) },
	onEnd: (evt) => { console.log(evt) },
	onReadyForPlay: (evt) => { console.log(evt) },
	onStalled: (evt) => { console.log(evt) },
	onResume: (evt) => { console.log(evt) },
	onRateChange: (evt) => { console.log(evt) }
	onPlayerError: (evt) => { console.log(evt) }
});

// 初始化
audio.init()
	  .then(() => {
	  		audio.setRepeat(true);
	  		audio.setMuted(false);
	  		audio.setVolume(1.0);
	  		audio.setRate(1.0);
	  		audio.setSrc("some audio url");
	  })
	  .then(() => {
	  		audio.play();
	  		audio.pause();
	  })
	  .then(() => {
	  		audio.seek(10);
	  		audio.play();
	  		audio.stop();
	  });
	  
// 注意释放,不使用的Audio对象必须手动释放,否则内存泄漏
audio.uninit();
	  
	  
// android下如需监听返回键退出全屏,在MainActivity添加如下代码

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == event.KEYCODE_BACK && OMVideoViewManager.cancelFullscreen()) {
        return true;
    }

    return super.onKeyDown(keyCode, event);
}