sciter自定义视频组件
By
admin
at 2020-05-17 • 0人收藏 • 1454人看过
感谢: 撒旦微笑 分享源码
import win.ui; /*DSG{{*/ var winform = win.form(text="sciter自定义视频组件";right=759;bottom=469) winform.add() /*}}*/ import web.sciter; var wbSciter = web.sciter( winform ); namespace web.sciter.behavior.player { onAttach = function (scOwner) { import mpvPlayer; var ltCtrl = scOwner.addCtrl(); scOwner.player = mpvPlayer(ltCtrl) var paused = true; pause = function(scOwner){ scOwner.player.pause(paused) paused = !paused }; playUrl = function(scOwner,url){ scOwner.player.loadFile(url); }; setVolume = function(scOwner,volume){ scOwner.player.setVolume(volume); }; var src = scOwner.getAttribute("src"); var volume = #scOwner.getAttribute("volume")?volume:50; if(src){ scOwner.playUrl(src); }; scOwner.setVolume(volume); } onDetach = function( scOwner ){ scOwner.delCtrl(); } onSize = function (scOwner) { scOwner.adjustCtrl(); } } wbSciter.html = /** <!doctype html> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/tiscript"> function self.ready() { var volume = $(video).@["volume"]; $(input#volume).value =volume||50; } event click $(#play) { this.text = (this.text=="播放")?"暂停":"播放" $(video).pause() } event change $(input#volume) { $(video).setVolume(this.value); } </script> <style type="text/css"> html,body{ height:100%; margin:0; } #header{ background:red; } video{ behavior:player; width:*; background:#000; height:width(56.25%); /* width/height = 16:9 */ } </style> </head> <body> <video src = "http://tv.ncist.edu.cn:281/live/cctv1hd.flv" volume =""/> <button#play>暂停</button> <input|hslider#volume min="1" max="100" step="1"> </input> </body> </html> **/ winform.show(); win.loopMessage();
登录后方可回帖