利用纯客户端JavaScript实现屏幕录制和截屏:JSCapture
JSCapture一个基于纯 JavaScript与HTML5实现的截屏库。
它可以让你从浏览器做您在桌面的截图和视频录制。JSCapture使用getUserMedia捕获屏幕。目前的屏幕捕捉API仅支持通过谷歌Chrome,和实际标志的Canary与Chromium。
API
JSCapture.capture(config)- Captures a new screenshot.config.x- (Number) default value0. Specifies the left offset.config.y- (Number) default value0. Specifies the top offset.config.width- (Number) default value the screen width. Specifies the width of the screenshot.config.height- (Number) default value the screen height. Specifies the height of the screenshot.config.process- (Function|Array) default value an empty array. A list of filters, which are going to process the image.config.done- (Function) default value isundefined. Callback, which is being called with the captured image.config.fail- (Function) default value isundefined. A callback, which is being executed on unsuccessful screen capturing (for example if the user does not allow screen capturing).config.delay- (Number) default value0. Specifies the delay after each the screenshot will be captured.
JSCapture.record(config)- Capture a video.config.x- (Number) default value0. Specifies the left offset.config.y- (Number) default value0. Specifies the top offset.config.width- (Number) default value the screen width. Specifies the width of the video.config.height- (Number) default value the screen height. Specifies the height of the video.config.process- (Function|Array) default value an empty array. A list of filters, which are going to process the individual frames.config.done- (Function) default value isundefined. Callback, which is being called with the captured video.config.delay- (Number) default value0. Specifies the delay after each the video will be captured.config.frameRate- (Number) default value60frames per second. Specifies the number of frames per second.config.done- (Function) default value isundefined. A callback, which accepts the video (as a Blob), result of the screen recording, as an argumentconfig.fail- (Function) default value isundefined. A callback, which is being executed on unsuccessful screen recording (for example if the user does not allow screen capturing).config.duration- (Number) default isInfinity. A number which indicates the length of the video.
JSCapture.stopRecording(fn)- Stops the video recording.fn- (Function) default value isundefined. A callback, which accepts the video (as a Blob), result of the screen recording, as an argument. Note that the callback provided inconfig.donewon't be invoked ifJSCapture.stopRecording(fn)is called.
JSCapture.isRecording()- (Boolean) Returns whether the screen recording have been started.
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!