| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- var media_count = 0;
- function img_play(src) {
- var height = 404;
- var width = 640;
- layer.open({
- area: [width + "px", height + "px"],
- type: 1,
- title: '图片预览',
- maxmin: true,
- closeBtn: 1,
- shadeClose: true,
- skin: 'layui-layer-nobg', //没有背景色
- shadeClose: true,
- resize: true,
- content: "<div style='height: 100%;width:100%;background:#000;text-align: center; '> <img src='" + src + "' style='height: 100%; '/></div>"
- });
- }
- function video_paly(src) {
- var height = 364;
- var width = 640;
- var css = "<style lang='css/text'>" + __inline('/node_modules/video.js/dist/video-js.min.css') + " .video-js .vjs-fullscreen-control { display: none;} </style>";
- var list = src.split(".");
- var videotype = list[list.length - 1]
- var html = css + '<video' +
- ' id="my-player' + (++media_count) + '"' +
- ' class="video-js"' +
- ' controls' +
- ' preload="auto"' +
- ' width="' + width + '" height="' + (height - 42) + '"' +
- ' data-setup=\'{}\'>' +
- ' <source src=\'' + src + '\' type="video/' + videotype + '"></source>' +
- ' <p class="vjs-no-js">' +
- ' To view this video please enable JavaScript, and consider upgrading to a' +
- ' web browser that' +
- ' <a href="http://videojs.com/html5-video-support/" target="_blank">' +
- ' supports HTML5 video' +
- ' </a>' +
- ' </p>' +
- '</video>';
- var lpayer = null;
- layer.open({
- area: [width + "px", height + "px"],
- type: 1,
- title: '视频播放',
- maxmin: true,
- closeBtn: 1,
- shadeClose: true,
- content: "<div id='video_content_div'>" + html + "</div>",
- success: function() {
- var options = {
- };
- lpayer = videojs('my-player' + media_count, options, function onPlayerReady() {
- videojs.log('Your player is ready!');
- // In this context, `this` is the player that was created by Video.js.
- this.play();
- // How about an event listener?
- this.on('ended', function() {
- videojs.log('Awww...over so soon?!');
- });
- });
- },
- full: function() {
- lpayer.width(window.innerWidth - 20);
- lpayer.height(window.innerHeight - 40 - 10);
- },
- restore: function() {
- lpayer.width(width);
- lpayer.height(height - 40);
- }
- });
- }
|