Skip to content

Commit 20d0580

Browse files
authored
Merge pull request #16 from Shobbak/fix/empty-video-compression
fix: empty video compression
2 parents ea2cf6f + 9c1aac3 commit 20d0580

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ android/keystores/debug.keystore
5858

5959
# generated by bob
6060
lib/
61+
.mtslconfig.json

ios/Video/VideoCompressor.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,16 @@ class VideoCompressor: RCTEventEmitter, URLSessionTaskDelegate {
177177
onFailure(error)
178178
return
179179
}
180-
let track = asset.tracks[0]
180+
var videoTrackIndex: Int = 0;
181+
let trackLength = asset.tracks.count;
182+
if(trackLength==2)
183+
{
184+
if(asset.tracks[0].mediaType.rawValue=="soun")
185+
{
186+
videoTrackIndex=1;
187+
}
188+
}
189+
let track = asset.tracks[videoTrackIndex];
181190
let exporter = NextLevelSessionExporter(withAsset: asset)
182191
exporter.outputURL = tmpURL
183192
exporter.outputFileType = AVFileType.mp4

0 commit comments

Comments
 (0)