Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
9f7d9548
Commit
9f7d9548
authored
Nov 15, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载视频
parent
11549fde
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
MediaFirstTest.java
yzg-util-image/src/test/java/helper/MediaFirstTest.java
+17
-1
No files found.
yzg-util-image/src/test/java/helper/MediaFirstTest.java
View file @
9f7d9548
...
...
@@ -4,6 +4,8 @@ import com.yanzuoguang.media.HlsDownloader;
import
com.yanzuoguang.media.MediaFirst
;
import
com.yanzuoguang.media.MediaReqVo
;
import
com.yanzuoguang.media.MediaResVo
;
import
com.yanzuoguang.util.MediaHelper
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
org.junit.Test
;
...
...
@@ -15,6 +17,17 @@ public class MediaFirstTest {
private
String
getFile
(
String
file
)
{
// 注意,路径应为文件在工程中的相对路径
File
f
=
new
File
(
"src/test/java/helper/"
+
file
);
if
(!
f
.
exists
())
{
System
.
out
.
println
(
f
.
getAbsoluteFile
());
throw
YzgError
.
getRuntimeException
(
"005"
);
}
return
f
.
getAbsolutePath
();
}
private
String
getTargetFile
(
String
file
)
{
// 注意,路径应为文件在工程中的相对路径
File
f
=
new
File
(
file
);
return
f
.
getAbsolutePath
();
}
...
...
@@ -37,11 +50,14 @@ public class MediaFirstTest {
@Test
public
void
testHlsDown
()
throws
Exception
{
String
targetFile
=
getTargetFile
(
"target/downHls.mp4"
);
HlsDownloader
downloader
=
new
HlsDownloader
(
"http://rtmp.tourbida.com/hls/0bfbec86-7a75-4b70-9318-dd32a3d59633.m3u8"
,
getFile
(
"downHls.mp4"
)
,
targetFile
,
1
,
1
);
downloader
.
download
(
true
,
true
);
// 获取视频第一帧
MediaHelper
.
getVideoFirstImage
(
targetFile
,
targetFile
+
".jpg"
);
}
}
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