1.0.87 • Published 6 years ago

react-native-omplayer v1.0.87

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

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);
}
1.0.87

6 years ago

1.0.86

6 years ago

1.0.85

6 years ago

1.0.84

6 years ago

1.0.83

6 years ago

1.0.82

6 years ago

1.0.81

6 years ago

1.0.80

6 years ago

1.0.79

6 years ago

1.0.78

6 years ago

1.0.77

6 years ago

1.0.76

6 years ago

1.0.75

6 years ago

1.0.74

6 years ago

1.0.73

6 years ago

1.0.72

6 years ago

1.0.71

6 years ago

1.0.70

6 years ago

1.0.69

6 years ago

1.0.68

6 years ago

1.0.67

6 years ago

1.0.66

6 years ago

1.0.65

6 years ago

1.0.64

6 years ago

1.0.63

6 years ago

1.0.62

6 years ago

1.0.61

7 years ago

1.0.60

7 years ago

1.0.59

7 years ago

1.0.58

7 years ago

1.0.57

7 years ago

1.0.56

7 years ago

1.0.55

7 years ago

1.0.54

7 years ago

1.0.53

7 years ago

1.0.52

7 years ago

1.0.51

7 years ago

1.0.50

7 years ago

1.0.49

7 years ago

1.0.48

7 years ago

1.0.47

7 years ago

1.0.46

7 years ago

1.0.45

7 years ago

1.0.44

7 years ago

1.0.43

7 years ago

1.0.42

8 years ago

1.0.41

8 years ago

1.0.40

8 years ago

1.0.39

8 years ago

1.0.38

8 years ago

1.0.37

8 years ago

1.0.36

8 years ago

1.0.35

8 years ago

1.0.34

8 years ago

1.0.33

8 years ago

1.0.32

8 years ago

1.0.31

8 years ago

1.0.30

8 years ago

1.0.29

8 years ago

1.0.28

8 years ago

1.0.27

8 years ago

1.0.26

8 years ago

1.0.25

8 years ago

1.0.24

8 years ago

1.0.23

8 years ago

1.0.22

8 years ago

1.0.21

8 years ago

1.0.20

8 years ago

1.0.18

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.13

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago