js实现音频声音文件可视化拖拽裁剪导出mp3声音文件代码
代码语言:html
所属分类:多媒体
代码描述:js实现音频声音文件可视化拖拽裁剪导出mp3声音文件代码
代码标签: js 音频 声音 文件 可视化 拖拽 裁剪 导出 mp3 声音 文件 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>音频可视化编辑器</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #0f172a, #1e293b);
color: #e2e8f0;
padding: 20px;
min-height: 100vh;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: rgba(15, 23, 42, 0.7);
backdrop-filter: blur(10px);
border-radius: 16px;
padding: 30px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
border: 1px solid rgba(148, 163, 184, 0.1);
}
h1 {
text-align: center;
margin-bottom: 30px;
color: #38bdf8;
font-size: 2.5rem;
text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}
.controls {
display: flex;
gap: 15px;
margin-bottom: 25px;
flex-wrap: wrap;
align-items: center;
}
button {
padding: 12px 24px;
border: none;
border-radius: 8px;
background: linear-gradient(135deg, #0ea5e9, #0284c7);
color: white;
cursor: pointer;
transition: all 0.3s ease;
font-weight: 600;
box-shadow: 0 4px 6px rgba(2, 132, 199, 0.2);
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(2, 132, 199, 0.3);
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
button.danger {
background: linear-gradient(135deg, #ef4444, #b91c1c);
box-shadow: 0 4px 6px rgba(185, 28, 28, 0.2);
}
button.danger:hover {
box-shadow: 0 6px 8px rgba(185, 28, 28, 0.3);
}
button.success {
background: linear-gradient(135deg, #22c55e, #15803d);
box-shadow: 0 4px 6px rgba(21, 128, 61, 0.2);
}
button.success:hover {
box-shadow: 0 6px 8px rgba(21, 128, 61, 0.3);
}
input[type="file"] {
display: none;
}
.file-input-label {
padding: 12px 24px;
border-radius: 8px;
background: linear-gradient(135deg, #8b5cf6, #7c3aed);
color: white;
cursor: pointer;
transition: all 0.3s ease;
font-weight: 600;
box-shadow: 0 4px 6px rgba(123, 58, 237, 0.2);
}
.file-input-label:hover {
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(123, 58, 237, 0.3);
}
#canvas {
width: 100%;
height: 200px;
background: rgba(2, 6, 23, 0.7);
border: 1px solid rgba(56, 189, 248, 0.3);
border-radius: 12px;
margin-bottom: 25px;
box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}
.time-display {
text-align: center;
font-size: 1.2rem;
margin-bottom: 15px;
color: #38bdf8;
font-weight: 600;
letter-spacing: 1px;
}
.slider-container {
margin: 25px 0;
}
input[type="range"] {
width: 100%;
height: 8px;
border-radius: 4px;
background: rgba(30, 41, 59, 0.7);
outline: none;
-webkit-appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #38bdf8;
cursor: pointer;
box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}
input[type="range"]::-moz-range-thumb {
width: 20px;
height: 20px;
border-radius: 50%;
background: #38bdf8;
cursor: pointer;
box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
border: none;
}
.selection-info {
background: rgba(30, 41, 59, 0.7);
padding: 20px;
border-radius: 12px;
margin-top: 25px;
border: 1px solid rgba(56, 189, 248, 0.2);
}
.selection-info h3 {
color: #38bdf8;
margin-bottom: 15px;
font-size: 1.4rem;
}
.url-input {
width: 100%;
padding: 12px 15px;
margin-bottom: 15px;
border: 1px solid rgba(56, 189, 248, 0.3);
border-radius: 8px;
background: rgba(15, 23, 42, 0.5);
color: #e2e8f0;
font-size: 1rem;
}
.url-input:focus {
outline: none;
border-color: #38bdf8;
box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
.file-info {
background: rgba(30, 41, 59, 0.7);
padding: 20px;
border-radius: 12px;
margin-top: 25px;
border: 1px solid rgba(56, 189, 248, 0.2);
}
.file-info h3 {
color: #38bdf8;
margin-bottom: 15px;
font-size: 1.4rem;
}
.file-info p {
margin: 8px 0;
color: #cbd5e1;
}
.file-info strong {
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0