mirror of
https://github.com/zhigang1992/react-native-video-cache.git
synced 2026-06-11 07:13:19 +08:00
prepare for release
This commit is contained in:
19
README.md
19
README.md
@@ -1,8 +1,16 @@
|
||||
# react-native-video-cache
|
||||
|
||||
Boost performance on online video loading and caching
|
||||
|
||||
Use following libraries to do the heavy lifting.
|
||||
|
||||
- iOS: https://github.com/ChangbaDevs/KTVHTTPCache
|
||||
- Android: https://github.com/danikula/AndroidVideoCache
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
`$ npm install react-native-video-cache --save`
|
||||
`$ yarn add react-native-video-cache`
|
||||
|
||||
### Mostly automatic installation
|
||||
|
||||
@@ -10,8 +18,9 @@
|
||||
|
||||
## Usage
|
||||
```javascript
|
||||
import VideoCache from 'react-native-video-cache';
|
||||
|
||||
// TODO: What to do with the module?
|
||||
VideoCache;
|
||||
import convertToProxyURL from 'react-native-video-cache';
|
||||
...
|
||||
const localProxiedURL = await convertToProxyURL(originalURL);
|
||||
...
|
||||
<Video source={{uri: localProxiedURL}} />
|
||||
```
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { Platform, StyleSheet, Text, View } from 'react-native';
|
||||
import VideoCache from 'react-native-video-cache';
|
||||
import convertToCache from 'react-native-video-cache';
|
||||
|
||||
export default class App extends Component<{}> {
|
||||
state = {
|
||||
@@ -18,7 +18,7 @@ export default class App extends Component<{}> {
|
||||
message: '--'
|
||||
};
|
||||
componentDidMount() {
|
||||
VideoCache.convert('https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4').then((message) => {
|
||||
convertToCache('https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4').then((message) => {
|
||||
this.setState({
|
||||
status: 'native callback received',
|
||||
message
|
||||
|
||||
1
index.d.ts
vendored
Normal file
1
index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function convert(url: string): Promise<string>
|
||||
2
index.js
2
index.js
@@ -2,4 +2,4 @@ import { NativeModules } from 'react-native';
|
||||
|
||||
const { VideoCache } = NativeModules;
|
||||
|
||||
export default VideoCache;
|
||||
export default VideoCache.convert;
|
||||
|
||||
10
package.json
10
package.json
@@ -2,11 +2,9 @@
|
||||
"name": "react-native-video-cache",
|
||||
"title": "React Native Video Cache",
|
||||
"version": "1.0.0",
|
||||
"description": "TODO",
|
||||
"description": "Boost performance on online video loading and caching",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhigang1992/react-native-video-cache.git",
|
||||
@@ -23,8 +21,8 @@
|
||||
"licenseFilename": "LICENSE",
|
||||
"readmeFilename": "README.md",
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.1",
|
||||
"react-native": ">=0.59.0-rc.0 <1.0.x"
|
||||
"react": "*",
|
||||
"react-native": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react": "^16.8.3",
|
||||
|
||||
Reference in New Issue
Block a user