Administrator
3 days ago b3eb99d598110351ad85f716f50a291941d58231
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<div class="layui-fluid layui-anim febs-anim" id="febs-video-player" lay-title="视频播放器">
    <div class="layui-row febs-container">
        <div class="layui-col-md12">
            <div class="layui-fluid">
                <div class="upload-container">
                    <div class="upload-header">
                        <h2>视频播放器</h2>
                        <p>支持视频文件播放和跳跃播放</p>
                    </div>
 
                    <!-- 播放区域 -->
                    <div class="play-container" id="playContainer">
                        <h3 style="margin-bottom: 20px; color: #333;">视频播放</h3>
                        <video id="videoPlayer" controls width="100%" height="auto" style="max-width: 800px;">
                            <source id="videoSource" src="" type="video/mp4">
                            您的浏览器不支持视频播放
                        </video>
                        <div class="layui-row layui-col-space10" style="margin-top: 20px;">
                            <div class="layui-col-xs12">
                                <div class="layui-input-inline" style="width: 400px;">
                                    <input type="text" id="videoUrl" placeholder="请输入视频播放地址" class="layui-input">
                                </div>
                                <button class="layui-btn layui-btn-normal" id="loadVideo">加载视频</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<style>
    .upload-container {
        max-width: 900px;
        margin: 30px auto;
        padding: 30px;
        background: #f8f8f8;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .upload-header {
        text-align: center;
        margin-bottom: 40px;
    }
    
    .upload-header h2 {
        color: #333;
        margin-bottom: 10px;
        font-size: 24px;
    }
    
    .upload-header p {
        color: #666;
        font-size: 14px;
    }
    
    .play-container {
        margin-top: 40px;
        padding: 30px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .play-container h3 {
        margin-bottom: 20px;
        color: #333;
        font-size: 20px;
    }
    
    video {
        width: 100%;
        max-width: 800px;
        height: auto;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    @media (max-width: 768px) {
        .upload-container {
            margin: 20px;
            padding: 20px;
        }
    }
</style>
<script data-th-inline="javascript">
    layui.use(['layer', 'jquery'], function() {
        var layer = layui.layer,
        $ = layui.jquery;
 
        // 初始化
        init();
 
        function init() {
            // 绑定加载视频按钮事件
            $('#loadVideo').click(function() {
                var videoUrl = $('#videoUrl').val().trim();
                if (!videoUrl) {
                    layer.msg('请输入视频播放地址', {icon: 2});
                    return;
                }
                loadVideo(videoUrl);
            });
        }
 
        // 加载视频
        function loadVideo(videoUrl) {
            var videoPlayer = document.getElementById('videoPlayer');
            var videoSource = document.getElementById('videoSource');
 
            // 根据文件扩展名设置正确的MIME类型
            var extension = videoUrl.split('.').pop().toLowerCase();
            var mimeType = 'video/mp4';
            switch(extension) {
                case 'avi':
                    mimeType = 'video/x-msvideo';
                    break;
                case 'mov':
                    mimeType = 'video/quicktime';
                    break;
                case 'wmv':
                    mimeType = 'video/x-ms-wmv';
                    break;
                case 'flv':
                    mimeType = 'video/x-flv';
                    break;
                case 'webm':
                    mimeType = 'video/webm';
                    break;
                case 'mkv':
                    mimeType = 'video/x-matroska';
                    break;
            }
 
            videoSource.src = videoUrl;
            videoSource.type = mimeType;
            videoPlayer.load();
            
            layer.msg('视频加载中...', {icon: 16, time: 0}, function() {
                layer.closeAll();
                layer.msg('视频加载完成', {icon: 1});
            });
        }
    });
</script>