Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
dz_TZImagePickerController
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuijing
dz_TZImagePickerController
Commits
bfd1677d
Commit
bfd1677d
authored
May 29, 2019
by
yuzheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化视频导出的一些细节
parent
3a7d7262
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
TZImagePickerController/TZImagePickerController/TZImageManager.m
...PickerController/TZImagePickerController/TZImageManager.m
+5
-5
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+1
-1
No files found.
TZImagePickerController/TZImagePickerController/TZImageManager.m
View file @
bfd1677d
...
@@ -587,11 +587,6 @@ static dispatch_once_t onceToken;
...
@@ -587,11 +587,6 @@ static dispatch_once_t onceToken;
NSDateFormatter
*
formater
=
[[
NSDateFormatter
alloc
]
init
];
NSDateFormatter
*
formater
=
[[
NSDateFormatter
alloc
]
init
];
[
formater
setDateFormat
:
@"yyyy-MM-dd-HH:mm:ss-SSS"
];
[
formater
setDateFormat
:
@"yyyy-MM-dd-HH:mm:ss-SSS"
];
NSString
*
outputPath
=
[
NSHomeDirectory
()
stringByAppendingFormat
:
@"/tmp/video-%@.mp4"
,
[
formater
stringFromDate
:[
NSDate
date
]]];
NSString
*
outputPath
=
[
NSHomeDirectory
()
stringByAppendingFormat
:
@"/tmp/video-%@.mp4"
,
[
formater
stringFromDate
:[
NSDate
date
]]];
if
(
videoAsset
.
URL
&&
videoAsset
.
URL
.
lastPathComponent
)
{
outputPath
=
[
outputPath
stringByReplacingOccurrencesOfString
:
@".mp4"
withString
:[
NSString
stringWithFormat
:
@"-%@"
,
videoAsset
.
URL
.
lastPathComponent
]];
}
// NSLog(@"video outputPath = %@",outputPath);
session
.
outputURL
=
[
NSURL
fileURLWithPath
:
outputPath
];
// Optimize for network use.
// Optimize for network use.
session
.
shouldOptimizeForNetworkUse
=
true
;
session
.
shouldOptimizeForNetworkUse
=
true
;
...
@@ -607,7 +602,12 @@ static dispatch_once_t onceToken;
...
@@ -607,7 +602,12 @@ static dispatch_once_t onceToken;
return
;
return
;
}
else
{
}
else
{
session
.
outputFileType
=
[
supportedTypeArray
objectAtIndex
:
0
];
session
.
outputFileType
=
[
supportedTypeArray
objectAtIndex
:
0
];
if
(
videoAsset
.
URL
&&
videoAsset
.
URL
.
lastPathComponent
)
{
outputPath
=
[
outputPath
stringByReplacingOccurrencesOfString
:
@".mp4"
withString
:[
NSString
stringWithFormat
:
@"-%@"
,
videoAsset
.
URL
.
lastPathComponent
]];
}
}
}
// NSLog(@"video outputPath = %@",outputPath);
session
.
outputURL
=
[
NSURL
fileURLWithPath
:
outputPath
];
if
(
!
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:[
NSHomeDirectory
()
stringByAppendingFormat
:
@"/tmp"
]])
{
if
(
!
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:[
NSHomeDirectory
()
stringByAppendingFormat
:
@"/tmp"
]])
{
[[
NSFileManager
defaultManager
]
createDirectoryAtPath
:[
NSHomeDirectory
()
stringByAppendingFormat
:
@"/tmp"
]
withIntermediateDirectories
:
YES
attributes
:
nil
error
:
nil
];
[[
NSFileManager
defaultManager
]
createDirectoryAtPath
:[
NSHomeDirectory
()
stringByAppendingFormat
:
@"/tmp"
]
withIntermediateDirectories
:
YES
attributes
:
nil
error
:
nil
];
...
...
TZImagePickerController/ViewController.m
View file @
bfd1677d
...
@@ -584,7 +584,7 @@
...
@@ -584,7 +584,7 @@
_selectedPhotos
=
[
NSMutableArray
arrayWithArray
:@[
coverImage
]];
_selectedPhotos
=
[
NSMutableArray
arrayWithArray
:@[
coverImage
]];
_selectedAssets
=
[
NSMutableArray
arrayWithArray
:@[
asset
]];
_selectedAssets
=
[
NSMutableArray
arrayWithArray
:@[
asset
]];
// open this code to send video / 打开这段代码发送视频
// open this code to send video / 打开这段代码发送视频
[[
TZImageManager
manager
]
getVideoOutputPathWithAsset
:
asset
presetName
:
AVAssetExportPreset
640x480
success
:^
(
NSString
*
outputPath
)
{
[[
TZImageManager
manager
]
getVideoOutputPathWithAsset
:
asset
presetName
:
AVAssetExportPreset
LowQuality
success
:^
(
NSString
*
outputPath
)
{
// NSData *data = [NSData dataWithContentsOfFile:outputPath];
// NSData *data = [NSData dataWithContentsOfFile:outputPath];
NSLog
(
@"视频导出到本地完成,沙盒路径为:%@"
,
outputPath
);
NSLog
(
@"视频导出到本地完成,沙盒路径为:%@"
,
outputPath
);
// Export completed, send video here, send by outputPath or NSData
// Export completed, send video here, send by outputPath or NSData
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment