mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
构建demo
This commit is contained in:
1 parent
ca31357292
commit
b64d5d5744
5 files changed
+2819
-2698
No files matched your search
+42
-3
@@ -2,9 +2,48 @@ html, body, .container {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.artplayer {
|
.container {
|
||||||
width: 800px;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.part-top {
|
||||||
|
display: flex;
|
||||||
|
height: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.part-bottom {
|
||||||
|
position: relative;
|
||||||
|
height: 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.part-left {
|
||||||
|
width: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.part-right {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.part-left .artplayer {
|
||||||
|
width: 500px;
|
||||||
height: 500px;
|
height: 500px;
|
||||||
margin: 20px auto 0;
|
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.part-right .preview {
|
||||||
|
width: 500px;
|
||||||
|
height: 500px;
|
||||||
|
background: #f3f3f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.part-right .preview img {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
+9
-1
@@ -17,7 +17,15 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="artplayer"></div>
|
<div class="part-top">
|
||||||
|
<div class="part-left">
|
||||||
|
<div class="artplayer"></div>
|
||||||
|
</div>
|
||||||
|
<div class="part-right">
|
||||||
|
<div class="preview"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="part-bottom"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./js/consola.js"></script>
|
<script src="./js/consola.js"></script>
|
||||||
<script src="../uncompiled/artplayer.js"></script>
|
<script src="../uncompiled/artplayer.js"></script>
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
consola.creat({
|
consola.creat({
|
||||||
target: 'body',
|
target: '.part-bottom',
|
||||||
|
size: '100%',
|
||||||
zIndex: 99,
|
zIndex: 99,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -30,5 +31,10 @@
|
|||||||
art.on('firstCanplay', () => {
|
art.on('firstCanplay', () => {
|
||||||
var preview = document.querySelector('.art-control-preview');
|
var preview = document.querySelector('.art-control-preview');
|
||||||
art.plugins.localPreview.attach(preview);
|
art.plugins.localPreview.attach(preview);
|
||||||
|
art.plugins.artplayerPluginGif.create({}, image => {
|
||||||
|
var animatedImage = document.createElement('img');
|
||||||
|
animatedImage.src = image;
|
||||||
|
document.querySelector('.preview').appendChild(animatedImage);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
+2744
-2692
File diff suppressed because it is too large.
Load diff
@@ -1,9 +1,25 @@
|
|||||||
import gifshot from 'gifshot';
|
import gifshot from 'gifshot';
|
||||||
|
|
||||||
function artplayerPluginGif(art) {
|
function artplayerPluginGif(art) {
|
||||||
console.log(gifshot);
|
|
||||||
return {
|
return {
|
||||||
name: 'artplayerPluginGif',
|
name: 'artplayerPluginGif',
|
||||||
|
create(config = {}, callback) {
|
||||||
|
gifshot.createGIF(
|
||||||
|
{
|
||||||
|
...config,
|
||||||
|
video: [art.template.$video.src],
|
||||||
|
},
|
||||||
|
obj => {
|
||||||
|
if (!obj.error) {
|
||||||
|
if (callback) {
|
||||||
|
callback(obj.image);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(obj.error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user