react-native-video-processing 1.6.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +1 -1
- package/CODE_OF_CONDUCT.md +46 -0
- package/ISSUE_TEMPLATE.md +21 -0
- package/README.md +97 -41
- package/_config.yml +1 -0
- package/android/build.gradle +26 -10
- package/android/react-native-video-processing.iml +8 -17
- package/android/src/main/java/com/shahenlibrary/Events/Events.java +2 -0
- package/android/src/main/java/com/shahenlibrary/RNVideoProcessingPackage.java +1 -2
- package/android/src/main/java/com/shahenlibrary/Trimmer/Trimmer.java +705 -112
- package/android/src/main/java/com/shahenlibrary/Trimmer/TrimmerManager.java +50 -7
- package/android/src/main/java/com/shahenlibrary/VideoPlayer/VideoPlayerView.java +80 -6
- package/android/src/main/java/com/shahenlibrary/VideoPlayer/VideoPlayerViewManager.java +35 -12
- package/android/src/main/java/com/shahenlibrary/interfaces/OnCompressVideoListener.java +8 -0
- package/android/src/main/java/com/shahenlibrary/utils/VideoEdit.java +34 -7
- package/android/src/main/jniLibs/arm64-v8a/libffmpeg.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libffmpeg.so +0 -0
- package/android/src/main/jniLibs/x86/libffmpeg.so +0 -0
- package/android/src/main/jniLibs/x86_64/libffmpeg.so +0 -0
- package/ios/RNVideoProcessing/RCTSwiftBridgeModule.h +29 -0
- package/ios/RNVideoProcessing/RNTrimmerView/ICGVideoTrimmer/ICGVideoTrimmerView.h +5 -0
- package/ios/RNVideoProcessing/RNTrimmerView/ICGVideoTrimmer/ICGVideoTrimmerView.m +48 -13
- package/ios/RNVideoProcessing/RNTrimmerView/RNTrimmerView.h +1 -0
- package/ios/RNVideoProcessing/RNTrimmerView/RNTrimmerView.swift +107 -36
- package/ios/RNVideoProcessing/RNTrimmerView/RNTrimmerViewBridge.m +4 -1
- package/ios/RNVideoProcessing/RNTrimmerView/RNTrimmerViewManager.swift +4 -1
- package/ios/RNVideoProcessing/RNVideoPlayer.swift +372 -291
- package/ios/RNVideoProcessing/RNVideoProcessingBridge.m +4 -1
- package/ios/RNVideoProcessing/RNVideoProcessingManager.swift +18 -4
- package/ios/RNVideoProcessing/RNVideoTrimmer/AVUtilities.swift +81 -0
- package/ios/RNVideoProcessing/RNVideoTrimmer/RNVideoTrimmer.swift +630 -207
- package/ios/RNVideoProcessing/RNVideoTrimmer/RNVideoTrimmerBridge.m +8 -3
- package/ios/RNVideoProcessing/RNVideoTrimmer/SDAVAssetExportSession.m +32 -32
- package/ios/RNVideoProcessing/VideoProcessingGPUFilters.swift +0 -1
- package/ios/RNVideoProcessing.xcodeproj/project.pbxproj +10 -3
- package/lib/ProcessingManager/ProcessingManager.android.js +81 -17
- package/lib/ProcessingManager/ProcessingManager.ios.js +72 -10
- package/lib/ProcessingManager/index.js +1 -1
- package/lib/ProcessingManager/test/ProcessingManager.test.js +24 -0
- package/lib/ProcessingManager/types.android.js +26 -0
- package/lib/ProcessingManager/types.ios.js +21 -3
- package/lib/Trimmer/Trimmer.android.js +4 -6
- package/lib/Trimmer/Trimmer.ios.js +15 -3
- package/lib/Trimmer/test/Trimmer.test.js +6 -3
- package/lib/Trimmer/test/__snapshots__/Trimmer.test.js.snap +4 -1
- package/lib/VideoPlayer/VideoPlayer.android.js +76 -8
- package/lib/VideoPlayer/VideoPlayer.ios.js +193 -171
- package/lib/VideoPlayer/test/__snapshots__/VideoPlayer.test.js.snap +4 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/test/trimmer.test.js +55 -0
- package/lib/utils/test/utils.test.js +1 -1
- package/lib/utils/trimmer.js +12 -0
- package/package.json +37 -26
- package/.npmignore +0 -60
- package/init/index.js +0 -7
- package/ios/GPUImage/.npmignore +0 -25
- package/yarn.lock +0 -6183
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* global expect */
|
|
2
|
+
import { calculateCornerResult, msToSec, numberToHHMMSS } from '../trimmer';
|
|
3
|
+
|
|
4
|
+
describe('[Trimmer Util]', () => {
|
|
5
|
+
describe('[msToSec]', () => {
|
|
6
|
+
it('should convert milisecond to second', () => {
|
|
7
|
+
const milisecond = 1000000;
|
|
8
|
+
const second = msToSec(milisecond);
|
|
9
|
+
expect(second).toBe(milisecond / 1000);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
describe('[calculateCornerResult]', () => {
|
|
13
|
+
it('should calculate corner result from left', () => {
|
|
14
|
+
const duration1 = 1000;
|
|
15
|
+
const value1 = 30;
|
|
16
|
+
const width1 = 500;
|
|
17
|
+
const result1 = calculateCornerResult(duration1, value1, width1);
|
|
18
|
+
|
|
19
|
+
expect(result1).toEqual(60);
|
|
20
|
+
|
|
21
|
+
const duration2 = 3400;
|
|
22
|
+
const value2 = 200;
|
|
23
|
+
const width2 = 400;
|
|
24
|
+
const result2 = calculateCornerResult(duration2, value2, width2);
|
|
25
|
+
|
|
26
|
+
expect(result2).toEqual(1700);
|
|
27
|
+
});
|
|
28
|
+
it('should calculate corner result from right', () => {
|
|
29
|
+
const duration1 = 1000;
|
|
30
|
+
const value1 = 30;
|
|
31
|
+
const width1 = 500;
|
|
32
|
+
const result1 = calculateCornerResult(duration1, value1, width1, true);
|
|
33
|
+
|
|
34
|
+
expect(result1).toEqual(1000 - 60);
|
|
35
|
+
|
|
36
|
+
const duration2 = 3400;
|
|
37
|
+
const value2 = 200;
|
|
38
|
+
const width2 = 400;
|
|
39
|
+
const result2 = calculateCornerResult(duration2, value2, width2, true);
|
|
40
|
+
|
|
41
|
+
expect(result2).toEqual(3400 - 1700);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should convert float to string for ffmpeg with numberToHHMMSS', () => {
|
|
45
|
+
let startTime = 0.0;
|
|
46
|
+
let endTime = 16.3;
|
|
47
|
+
|
|
48
|
+
startTime = numberToHHMMSS({ number: startTime });
|
|
49
|
+
endTime = numberToHHMMSS({ number: endTime });
|
|
50
|
+
|
|
51
|
+
expect(startTime).toEqual( '00:00:00.000' );
|
|
52
|
+
expect(endTime).toEqual( '00:00:16.300' );
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -14,7 +14,7 @@ describe('[Utils]', () => {
|
|
|
14
14
|
});
|
|
15
15
|
it('using require(), should return string', () => {
|
|
16
16
|
const returnValue = getActualSource(require('../../../test.jpeg'));
|
|
17
|
-
expect(returnValue).toMatch(/
|
|
17
|
+
expect(returnValue).toMatch(/assets/);
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
20
|
});
|
package/lib/utils/trimmer.js
CHANGED
|
@@ -12,3 +12,15 @@ export function calculateCornerResult(duration, value, width, fromRight) {
|
|
|
12
12
|
export function msToSec(ms) {
|
|
13
13
|
return ms / 1000;
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
export function numberToHHMMSS({ number }) {
|
|
17
|
+
let sec_num = number;
|
|
18
|
+
let hours = Math.floor(sec_num / 3600);
|
|
19
|
+
let minutes = Math.floor((sec_num - (hours * 3600)) / 60);
|
|
20
|
+
let seconds = (sec_num - (hours * 3600) - (minutes * 60)).toFixed(3);
|
|
21
|
+
|
|
22
|
+
if (hours < 10) {hours = "0"+hours;}
|
|
23
|
+
if (minutes < 10) {minutes = "0"+minutes;}
|
|
24
|
+
if (seconds < 10) {seconds = "0"+seconds;}
|
|
25
|
+
return hours+':'+minutes+':'+seconds;
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-video-processing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Native Video processing/editing for React-Native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"commit": "git add . && git-cz",
|
|
8
|
-
"test": "
|
|
8
|
+
"test": "echo 'tests are disabled'",
|
|
9
9
|
"test:snapshots": "jest -u",
|
|
10
10
|
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
|
|
11
11
|
},
|
|
@@ -32,35 +32,46 @@
|
|
|
32
32
|
"url": "https://github.com/shahen94/react-native-video-processing/issues"
|
|
33
33
|
},
|
|
34
34
|
"jest": {
|
|
35
|
-
"preset": "jest-react-native"
|
|
35
|
+
"preset": "jest-react-native",
|
|
36
|
+
"testPathIgnorePatterns": [
|
|
37
|
+
"/node_modules/"
|
|
38
|
+
],
|
|
39
|
+
"moduleFileExtensions": [
|
|
40
|
+
"js",
|
|
41
|
+
"jsx",
|
|
42
|
+
"json"
|
|
43
|
+
],
|
|
44
|
+
"moduleDirectories": [
|
|
45
|
+
"packages",
|
|
46
|
+
"node_modules"
|
|
47
|
+
]
|
|
36
48
|
},
|
|
37
49
|
"homepage": "https://github.com/shahen94/react-native-video-processing#readme",
|
|
38
50
|
"dependencies": {
|
|
39
|
-
"babel-preset-es2015": "6.
|
|
40
|
-
"babel-preset-react": "6.
|
|
41
|
-
"babel-preset-react-native": "
|
|
51
|
+
"babel-preset-es2015": "^6.24.1",
|
|
52
|
+
"babel-preset-react": "^6.24.1",
|
|
53
|
+
"babel-preset-react-native": "^4.0.0",
|
|
42
54
|
"babel-preset-react-native-stage-0": "1.0.1",
|
|
43
|
-
"lodash": "^4.16.6"
|
|
44
|
-
"react": "^15.3.2"
|
|
55
|
+
"lodash": "^4.16.6"
|
|
45
56
|
},
|
|
46
57
|
"devDependencies": {
|
|
47
|
-
"babel-eslint": "
|
|
48
|
-
"babel-jest": "
|
|
58
|
+
"babel-eslint": "8.0.1",
|
|
59
|
+
"babel-jest": "21.2.0",
|
|
49
60
|
"commitizen": "^2.8.6",
|
|
50
|
-
"cz-conventional-changelog": "^1.
|
|
51
|
-
"eslint": "
|
|
52
|
-
"eslint-config-airbnb": "
|
|
53
|
-
"eslint-plugin-
|
|
54
|
-
"eslint-plugin-
|
|
55
|
-
"eslint-plugin-react
|
|
56
|
-
"
|
|
57
|
-
"jest
|
|
58
|
-
"react-native": "
|
|
59
|
-
"
|
|
60
|
-
"react
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
61
|
+
"cz-conventional-changelog": "^2.1.0",
|
|
62
|
+
"eslint": "4.10.0",
|
|
63
|
+
"eslint-config-airbnb": "16.1.0",
|
|
64
|
+
"eslint-plugin-import": "^2.8.0",
|
|
65
|
+
"eslint-plugin-jsx-a11y": "6.0.2",
|
|
66
|
+
"eslint-plugin-react": "7.4.0",
|
|
67
|
+
"eslint-plugin-react-native": "3.1.0",
|
|
68
|
+
"jest": "21.2.1",
|
|
69
|
+
"jest-react-native": "18.0.0",
|
|
70
|
+
"prop-types": "^15.6.0",
|
|
71
|
+
"react": "16.0.0-beta.5",
|
|
72
|
+
"react-native": "^0.49.5",
|
|
73
|
+
"react-native-create-library": "^3.1.2",
|
|
74
|
+
"react-test-renderer": "16.0.0",
|
|
75
|
+
"semantic-release": "^17.2.3"
|
|
65
76
|
}
|
|
66
|
-
}
|
|
77
|
+
}
|
package/.npmignore
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# MacOS temporary files
|
|
2
|
-
.DS_Store
|
|
3
|
-
|
|
4
|
-
# Logs
|
|
5
|
-
logs
|
|
6
|
-
*.log
|
|
7
|
-
npm-debug.log*
|
|
8
|
-
|
|
9
|
-
# Runtime data
|
|
10
|
-
pids
|
|
11
|
-
*.pid
|
|
12
|
-
*.seed
|
|
13
|
-
|
|
14
|
-
# Xcode
|
|
15
|
-
#
|
|
16
|
-
build/
|
|
17
|
-
*.pbxuser
|
|
18
|
-
!default.pbxuser
|
|
19
|
-
*.mode1v3
|
|
20
|
-
!default.mode1v3
|
|
21
|
-
*.mode2v3
|
|
22
|
-
!default.mode2v3
|
|
23
|
-
*.perspectivev3
|
|
24
|
-
!default.perspectivev3
|
|
25
|
-
xcuserdata
|
|
26
|
-
*.xccheckout
|
|
27
|
-
*.moved-aside
|
|
28
|
-
DerivedData
|
|
29
|
-
*.hmap
|
|
30
|
-
*.ipa
|
|
31
|
-
*.xcuserstate
|
|
32
|
-
project.xcworkspace
|
|
33
|
-
|
|
34
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
35
|
-
lib-cov
|
|
36
|
-
|
|
37
|
-
# Coverage directory used by tools like istanbul
|
|
38
|
-
coverage
|
|
39
|
-
|
|
40
|
-
# nyc test coverage
|
|
41
|
-
.nyc_output
|
|
42
|
-
|
|
43
|
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
44
|
-
.grunt
|
|
45
|
-
|
|
46
|
-
# node-waf configuration
|
|
47
|
-
.lock-wscript
|
|
48
|
-
|
|
49
|
-
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
50
|
-
build/Release
|
|
51
|
-
|
|
52
|
-
# Dependency directories
|
|
53
|
-
node_modules
|
|
54
|
-
jspm_packages
|
|
55
|
-
|
|
56
|
-
# Optional npm cache directory
|
|
57
|
-
.npm
|
|
58
|
-
|
|
59
|
-
# Optional REPL history
|
|
60
|
-
.node_repl_history
|
package/init/index.js
DELETED
package/ios/GPUImage/.npmignore
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Exclude the build directory
|
|
2
|
-
build/*
|
|
3
|
-
examples/FilterShowcase/build*
|
|
4
|
-
|
|
5
|
-
# Exclude temp nibs and swap files
|
|
6
|
-
*~.nib
|
|
7
|
-
*.swp
|
|
8
|
-
|
|
9
|
-
# Exclude OS X folder attributes
|
|
10
|
-
.DS_Store
|
|
11
|
-
.svn
|
|
12
|
-
|
|
13
|
-
# Exclude user-specific XCode 3 and 4 files
|
|
14
|
-
*.mode1
|
|
15
|
-
*.mode1v3
|
|
16
|
-
*.mode2v3
|
|
17
|
-
*.perspective
|
|
18
|
-
*.perspectivev3
|
|
19
|
-
*.pbxuser
|
|
20
|
-
*.xcworkspace
|
|
21
|
-
xcuserdata
|
|
22
|
-
|
|
23
|
-
# Documentation
|
|
24
|
-
documentation/*
|
|
25
|
-
|