1.0.87 • Published 4 years ago

react-native-omplayer v1.0.87

Weekly downloads
-
License
ISC
Repository
-
Last release
4 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

4 years ago

1.0.86

4 years ago

1.0.85

4 years ago

1.0.84

4 years ago

1.0.83

4 years ago

1.0.82

4 years ago

1.0.81

5 years ago

1.0.80

5 years ago

1.0.79

5 years ago

1.0.78

5 years ago

1.0.77

5 years ago

1.0.76

5 years ago

1.0.75

5 years ago

1.0.74

5 years ago

1.0.73

5 years ago

1.0.72

5 years ago

1.0.71

5 years ago

1.0.70

5 years ago

1.0.69

5 years ago

1.0.68

5 years ago

1.0.67

5 years ago

1.0.66

5 years ago

1.0.65

5 years ago

1.0.64

5 years ago

1.0.63

5 years ago

1.0.62

5 years ago

1.0.61

6 years ago

1.0.60

6 years ago

1.0.59

6 years ago

1.0.58

6 years ago

1.0.57

6 years ago

1.0.56

6 years ago

1.0.55

6 years ago

1.0.54

6 years ago

1.0.53

6 years ago

1.0.52

6 years ago

1.0.51

6 years ago

1.0.50

6 years ago

1.0.49

6 years ago

1.0.48

6 years ago

1.0.47

6 years ago

1.0.46

6 years ago

1.0.45

6 years ago

1.0.44

6 years ago

1.0.43

6 years ago

1.0.42

6 years ago

1.0.41

6 years ago

1.0.40

6 years ago

1.0.39

6 years ago

1.0.38

6 years ago

1.0.37

7 years ago

1.0.36

7 years ago

1.0.35

7 years ago

1.0.34

7 years ago

1.0.33

7 years ago

1.0.32

7 years ago

1.0.31

7 years ago

1.0.30

7 years ago

1.0.29

7 years ago

1.0.28

7 years ago

1.0.27

7 years ago

1.0.26

7 years ago

1.0.25

7 years ago

1.0.24

7 years ago

1.0.23

7 years ago

1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.13

7 years ago

1.0.11

7 years ago

1.0.10

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