Skip to content

Commit 1116eb5

Browse files
committed
Ultrawide support for Android
1 parent 2461cea commit 1116eb5

File tree

9 files changed

+64
-7
lines changed

9 files changed

+64
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.idea/
2+
testapp/node_modules/

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ repositories {
7373
}
7474
}
7575
dependencies {
76-
compile 'com.github.selsamman:android-transcoder:0.3.62'
76+
compile 'com.github.selsamman:android-transcoder:0.3.66'
7777
compile 'com.facebook.react:react-native:+'
7878
}

android/src/main/java/com/selsamman/transcode/TranscodeModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ public void onTranscodeFailed(Exception e) {
137137
MediaTranscoder.getInstance().transcodeVideo(
138138
timeLine, outputFileName,
139139
resolution.equals("high")?
140-
MediaFormatStrategyPresets.createAndroid16x9Strategy1080P(Android16By9FormatStrategy.AUDIO_BITRATE_AS_IS, Android16By9FormatStrategy.AUDIO_CHANNELS_AS_IS) :
141-
MediaFormatStrategyPresets.createAndroid16x9Strategy720P(Android16By9FormatStrategy.AUDIO_BITRATE_AS_IS, 1),
140+
MediaFormatStrategyPresets.createAndroidStrategy1080P(Android16By9FormatStrategy.AUDIO_BITRATE_AS_IS, Android16By9FormatStrategy.AUDIO_CHANNELS_AS_IS) :
141+
MediaFormatStrategyPresets.createAndroidStrategy720P(Android16By9FormatStrategy.AUDIO_BITRATE_AS_IS, 1),
142142
listener);
143143
} catch (Exception e) {
144144
promise.reject("Exception", e);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-native-transcode",
33
"description": "Transcoder",
44
"author": "Sam Elsamman <sams@elsamman.com>",
5-
"version": "0.0.70",
5+
"version": "0.0.72",
66
"main": "components/Transcode.js",
77
"repository": {
88
"type": "git",

testapp/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ var TEST_REQUIRES = [
2020
require('./tests/OrientationR0'),
2121
require('./tests/OrientationR90'),
2222
require('./tests/OrientationR180'),
23-
require('./tests/OrientationR270')];
23+
require('./tests/OrientationR270'),
24+
require('./tests/UltraWide')];
2425

2526
TEST_REQUIRES.forEach(
2627
(test) => {
2728
AppRegistry.registerComponent(test.displayName, () => test)
29+
console.log(`Loading ${test.displayName}`);
2830
test = {test: test}
2931
}
3032
);

testapp/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
android:icon="@mipmap/ic_launcher"
1010
android:roundIcon="@mipmap/ic_launcher_round"
1111
android:allowBackup="false"
12-
android:theme="@style/AppTheme">
12+
android:theme="@style/AppTheme"
13+
android:usesCleartextTraffic="true">
1314
<activity
1415
android:name=".MainActivity"
1516
android:label="@string/app_name"
6.85 MB
Binary file not shown.

testapp/tests/UltraWide.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import React from 'react';
2+
import LoggingTestModule from './LoggingTestModule';
3+
import Transcode from 'react-native-transcode';
4+
import AbstractTest from './AbstractTest';
5+
import RNFetchBlob from 'rn-fetch-blob';
6+
7+
class UltraWide extends AbstractTest {
8+
9+
constructor(props) {
10+
super(props);
11+
}
12+
13+
async testBody(progressCallback) {
14+
15+
var R0 = await this.prepFile('r0ultrawide.mp4');
16+
var R90 = await this.prepFile('r90.mp4');
17+
var R180 = await this.prepFile('r180.mp4');
18+
var R270 = await this.prepFile('r270.mp4');
19+
var outputFile = RNFetchBlob.fs.dirs.DocumentDir + '/output_' + UltraWide.displayName + '.mp4';
20+
try {await RNFetchBlob.fs.unlink(outputFile)}catch(e){};
21+
22+
const status = await Transcode.start()
23+
.asset({name: "A", path: R0})
24+
.asset({name: "B", path: R90})
25+
.asset({name: "C", path: R180})
26+
.asset({name: "D", path: R270})
27+
.segment(1000)
28+
.track({asset: "A"})
29+
.segment(1000)
30+
.track({asset: "A", filter: "FadeOut"})
31+
.track({asset: "B", filter: "FadeIn"})
32+
.segment(1000)
33+
.track({asset: "B"})
34+
.segment(1000)
35+
.track({asset: "B", filter: "FadeOut"})
36+
.track({asset: "C", filter: "FadeIn"})
37+
.segment(1000)
38+
.track({asset: "C"})
39+
.segment(1000)
40+
.track({asset: "C", filter: "FadeOut"})
41+
.track({asset: "D", filter: "FadeIn"})
42+
.segment(1000)
43+
.track({asset: "D"})
44+
.process("low", outputFile, (progress)=>{progressCallback(progress)});
45+
46+
LoggingTestModule.assertEqual('Finished', status);
47+
LoggingTestModule.assertEqual((await RNFetchBlob.fs.stat(outputFile)).size > 0, true);
48+
}
49+
};
50+
51+
UltraWide.displayName = 'UltraWide';
52+
53+
module.exports = UltraWide;

testapp/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5092,7 +5092,7 @@ react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0:
50925092
integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==
50935093

50945094
"react-native-transcode@file:..":
5095-
version "0.0.69"
5095+
version "0.0.71"
50965096

50975097
react-native-video@^5.0.2:
50985098
version "5.0.2"

0 commit comments

Comments
 (0)