Commit 07f99ec5 authored by yanzg's avatar yanzg

下载视频

parent 89cdde35
package helper; package helper;
import com.yanzuoguang.media.HlsDownloader;
import com.yanzuoguang.media.MediaFirst; import com.yanzuoguang.media.MediaFirst;
import com.yanzuoguang.media.MediaReqVo; import com.yanzuoguang.media.MediaReqVo;
import com.yanzuoguang.media.MediaResVo; import com.yanzuoguang.media.MediaResVo;
...@@ -11,6 +12,12 @@ import java.io.File; ...@@ -11,6 +12,12 @@ import java.io.File;
public class MediaFirstTest { public class MediaFirstTest {
private String getFile(String file) {
// 注意,路径应为文件在工程中的相对路径
File f = new File("src/test/java/helper/" + file);
return f.getAbsolutePath();
}
@Test @Test
public void test() { public void test() {
MediaFirst first = new MediaFirst(); MediaFirst first = new MediaFirst();
...@@ -26,4 +33,16 @@ public class MediaFirstTest { ...@@ -26,4 +33,16 @@ public class MediaFirstTest {
} }
} }
@Test
public void testHlsDown() throws Exception {
HlsDownloader downloader = new HlsDownloader("http://rtmp.tourbida.com/hls/0bfbec86-7a75-4b70-9318-dd32a3d59633.m3u8",
getFile("downHls.mp4"),
3,
100
);
downloader.download(true, true);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment