Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
l1tok committed Sep 22, 2023
1 parent f66a485 commit 715593f
Show file tree
Hide file tree
Showing 3 changed files with 5,138 additions and 5,094 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ const play = (instance: EChartsType, data: RepoActivityDetails) => {
if (i == months.length - 1) {
// Stop the media recorder after the animation finishes
// instance.on('finished', function () {
stopRecording();
const rec = document.getElementById('rec');
if(rec!=null) rec.innerText = 'record'
stopRecording();
const rec = document.getElementById('rec');
if (rec != null) rec.innerText = 'record';
// });
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export function stopRecording() {
const rec = document.getElementById('rec');
// @ts-ignore
rec.innerText = 'record';

}
}
const View = ({ currentRepo, repoActivityDetails }: Props): JSX.Element => {
Expand All @@ -43,30 +42,31 @@ const View = ({ currentRepo, repoActivityDetails }: Props): JSX.Element => {
setReplay(replay + 1);
};


// Event listener for the start button
const exportToVideo = () => {
// Start the recording only if it has not already started
if (!recordingStarted) {
recordingStarted = true;
// Capture the canvas element
console.log('start media ' + recordingStarted);
const canvas = document.querySelector('#hypercrx-repo-activity-racing-bar > div > div > div.d-flex.flex-wrap.flex-items-center > div.col-12.col-md-8 > div > div > div > div > div > div > canvas') as HTMLCanvasElement;
const canvas = document.querySelector(
'#hypercrx-repo-activity-racing-bar > div > div > div.d-flex.flex-wrap.flex-items-center > div.col-12.col-md-8 > div > div > div > div > div > div > canvas'
) as HTMLCanvasElement;
const rec = document.getElementById('rec');

if (!canvas || !rec) {
return;
}

rec.innerText = '录制中,点击停止录制并下载';
const stream = canvas.captureStream();

// Start the media recorder
const chunks: Blob[] = [];
mediaRecorder = new MediaRecorder(stream, {
mimeType: 'video/webm; codecs=vp9',
});

mediaRecorder.ondataavailable = function (event) {
chunks.push(event.data);
};
Expand Down
Loading

0 comments on commit 715593f

Please sign in to comment.