mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-11 13:56:15 -08:00
update docs
This commit is contained in:
1 parent
b97e49bead
commit
e96778746a
3 files changed
+31
-34
No files matched your search
+15
-14
@@ -1,13 +1,24 @@
|
||||
.container {
|
||||
width: 900px;
|
||||
width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.artplayer-app {
|
||||
width: 400px;
|
||||
height: 300px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
height: 450px;
|
||||
margin: 0 auto 20px;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.error-tip {
|
||||
font-size: 13px;
|
||||
padding: 5px 10px;
|
||||
margin-bottom: 20px;
|
||||
color: red;
|
||||
background: rgba(255, 0, 0, 0.1);
|
||||
border: 1px solid red;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.CodeMirror {
|
||||
@@ -18,14 +29,4 @@
|
||||
.CodeMirror pre {
|
||||
padding-left: 7px;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.control {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.control .header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
+4
-7
@@ -19,13 +19,10 @@
|
||||
<div class="container">
|
||||
<div class="artplayer-app"></div>
|
||||
<div class="error-tip"></div>
|
||||
<div class="control-list">
|
||||
<div class="control">
|
||||
<div class="header">
|
||||
<div class="title">简单用法</div>
|
||||
<div class="run">运行</div>
|
||||
</div>
|
||||
<div class="code"></div>
|
||||
<div class="control">
|
||||
<div class="code"></div>
|
||||
<div class="bottom">
|
||||
<input class="run" type="button" value="执行代码">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+12
-13
@@ -17,29 +17,26 @@ function initApp(app) {
|
||||
});
|
||||
}
|
||||
|
||||
function timeTaken(callback) {
|
||||
console.time('timeTaken');
|
||||
const r = callback();
|
||||
console.timeEnd('timeTaken');
|
||||
return r;
|
||||
}
|
||||
|
||||
var $error = document.querySelector('.error-tip');
|
||||
document.querySelector('.run').addEventListener('click', function (e) {
|
||||
function runApp() {
|
||||
try {
|
||||
Artplayer.instances.forEach(ins => {
|
||||
ins.destroy(true)
|
||||
});;
|
||||
timeTaken(function () {
|
||||
eval(mirror.getValue());
|
||||
});
|
||||
eval(mirror.getValue());
|
||||
initApp(Artplayer.instances[0]);
|
||||
$error.style.display = 'none';
|
||||
$error.innerHTML = '';
|
||||
} catch (error) {
|
||||
var msg = error.message.trim();
|
||||
$error.style.display = 'block';
|
||||
$error.innerHTML = '请打开控制台:' + msg;
|
||||
console.error(msg);
|
||||
}
|
||||
}
|
||||
|
||||
var $error = document.querySelector('.error-tip');
|
||||
document.querySelector('.run').addEventListener('click', function (e) {
|
||||
runApp();
|
||||
});
|
||||
|
||||
creatCodeMirror(`
|
||||
@@ -47,4 +44,6 @@ new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: 'https://blog.zhw-island.com/assets-cdn/video/one-more-time-one-more-chance-480p.mp4'
|
||||
});
|
||||
`);
|
||||
`);
|
||||
|
||||
runApp();
|
||||
Reference in new issue
Block a user