支持flv视频预览
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
package cn.keking.service.impl;
|
package cn.keking.service.impl;
|
||||||
|
|
||||||
|
import cn.keking.model.FileAttribute;
|
||||||
import cn.keking.service.FilePreview;
|
import cn.keking.service.FilePreview;
|
||||||
import cn.keking.utils.FileUtils;
|
import cn.keking.utils.FileUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -20,6 +21,11 @@ public class MediaFilePreviewImpl implements FilePreview {
|
|||||||
@Override
|
@Override
|
||||||
public String filePreviewHandle(String url, Model model) {
|
public String filePreviewHandle(String url, Model model) {
|
||||||
model.addAttribute("mediaUrl", url);
|
model.addAttribute("mediaUrl", url);
|
||||||
|
FileAttribute fileAttribute=fileUtils.getFileAttribute(url);
|
||||||
|
String suffix=fileAttribute.getSuffix();
|
||||||
|
if ("flv".equalsIgnoreCase(suffix)) {
|
||||||
|
return "flv";
|
||||||
|
}
|
||||||
return "media";
|
return "media";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
7
jodconverter-web/src/main/resources/static/js/flv.min.js
vendored
Normal file
7
jodconverter-web/src/main/resources/static/js/flv.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
30
jodconverter-web/src/main/resources/web/flv.ftl
Normal file
30
jodconverter-web/src/main/resources/web/flv.ftl
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>多媒体文件预览</title>
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
body{background-color: #262626}
|
||||||
|
.m{ margin-left: auto; margin-right: auto; width:1024px; margin-top: 100px; }
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<div class="m">
|
||||||
|
<video width="1024" id="videoElement"></video>
|
||||||
|
</div>
|
||||||
|
<script src="js/flv.min.js"></script>
|
||||||
|
<script>
|
||||||
|
if (flvjs.isSupported()) {
|
||||||
|
var videoElement = document.getElementById('videoElement');
|
||||||
|
var flvPlayer = flvjs.createPlayer({
|
||||||
|
type: 'flv',
|
||||||
|
url: '${mediaUrl}'
|
||||||
|
});
|
||||||
|
flvPlayer.attachMediaElement(videoElement);
|
||||||
|
flvPlayer.load();
|
||||||
|
flvPlayer.play();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user