Skip to content

Commit 673f3a3

Browse files
committed
Supported new mode: SCREEN_ANIMATION
1 parent bd39eb8 commit 673f3a3

File tree

4 files changed

+255
-123
lines changed

4 files changed

+255
-123
lines changed

examples/screen-animation.html

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Screen-only Example - Record Plugin for Video.js</title>
7+
8+
<link href="../node_modules/video.js/dist/video-js.min.css" rel="stylesheet">
9+
<link href="../dist/css/videojs.record.css" rel="stylesheet">
10+
<link href="assets/css/examples.css" rel="stylesheet">
11+
12+
<script src="../node_modules/video.js/dist/video.min.js"></script>
13+
<script src="../node_modules/recordrtc/RecordRTC.js"></script>
14+
<script src="../node_modules/webrtc-adapter/out/adapter.js"></script>
15+
16+
<script src="../dist/videojs.record.js"></script>
17+
18+
<script src="browser-workarounds.js"></script>
19+
20+
<style>
21+
/* change player background color */
22+
23+
#myScreen {
24+
background-color: #c3c4bc;
25+
}
26+
</style>
27+
</head>
28+
29+
<body>
30+
31+
<video id="myScreen" playsinline class="video-js vjs-default-skin"></video>
32+
33+
<script>
34+
/* eslint-disable */
35+
var options = {
36+
controls: true,
37+
width: 800,
38+
height: 450,
39+
fluid: false,
40+
bigPlayButton: false,
41+
controlBar: {
42+
volumePanel: false,
43+
fullscreenToggle: false
44+
},
45+
plugins: {
46+
record: {
47+
screen: true,
48+
displayMilliseconds: false,
49+
animation: true,
50+
animationQuality: 20,
51+
animationFrameRate: 200,
52+
maxLength: 5,
53+
debug: true
54+
}
55+
}
56+
};
57+
58+
// apply some workarounds for certain browsers
59+
applyVideoWorkaround();
60+
applyScreenWorkaround();
61+
62+
var player = videojs('myScreen', options, function() {
63+
// print version information at startup
64+
var msg = 'Using video.js ' + videojs.VERSION +
65+
' with videojs-record ' + videojs.getPluginVersion('record') +
66+
' and recordrtc ' + RecordRTC.version;
67+
videojs.log(msg);
68+
});
69+
70+
// error handling
71+
player.on('deviceError', function() {
72+
console.warn('device error:', player.deviceErrorCode);
73+
});
74+
75+
player.on('error', function(element, error) {
76+
console.error(error);
77+
});
78+
79+
// snapshot is available
80+
player.on('finishRecord', function() {
81+
// the blob object contains the image data that
82+
// can be downloaded by the user, stored on server etc.
83+
console.log('screen recording ready: ', player.recordedData);
84+
player.record().saveAs({
85+
gif: 'hari.gif'
86+
})
87+
});
88+
</script>
89+
90+
</body>
91+
92+
</html>

0 commit comments

Comments
 (0)