Commit e7571e72 by ramdayalmunda

pause added

parent ab33596e
...@@ -58,6 +58,28 @@ var getUserDetails = null ...@@ -58,6 +58,28 @@ var getUserDetails = null
sendMessageToActiveTab("recordingStarted") sendMessageToActiveTab("recordingStarted")
return return
} }
if (loggedIn && request.action === 'pauseRecording') {
recording = false;
sendResponse({
userDetails,
loggedIn,
recording,
status: tutorShotId?(recording?"recording":"paused"):"stopped"
});
sendMessageToActiveTab("recordingPaused")
return
}
if (loggedIn && request.action === 'resumeRecording') {
recording = true;
sendResponse({
userDetails,
loggedIn,
recording,
status: tutorShotId?(recording?"recording":"paused"):"stopped"
});
sendMessageToActiveTab("recordingPaused")
return
}
if (loggedIn && request.action === 'stopRecording') { if (loggedIn && request.action === 'stopRecording') {
recording = false; recording = false;
tutorShotId = null tutorShotId = null
......
...@@ -86,6 +86,8 @@ var btn = {} ...@@ -86,6 +86,8 @@ var btn = {}
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
width: 420px; width: 420px;
margin-left: 5px;
margin-right: 5px;
} }
.tutor-shot .content .item { .tutor-shot .content .item {
...@@ -123,7 +125,7 @@ var btn = {} ...@@ -123,7 +125,7 @@ var btn = {}
<div class="content"> <div class="content">
<div class="item" tutor-shot="play-btn"> <div class="item" tutor-shot="play-btn">
<img class="img" src="${origin}/assets/icons/play.svg" width="20"> <img class="img" src="${origin}/assets/icons/play.svg" width="20">
<span class="item-text" tutor-shot="play-text">CONTINUE</span> <span class="item-text" tutor-shot="play-text">RESUME</span>
</div> </div>
<div class="item" tutor-shot="pause-btn"> <div class="item" tutor-shot="pause-btn">
<img class="img" src="${origin}/assets/icons/pause.svg" width="20"> <img class="img" src="${origin}/assets/icons/pause.svg" width="20">
...@@ -191,11 +193,11 @@ function reRenderFloatingBar(data) { ...@@ -191,11 +193,11 @@ function reRenderFloatingBar(data) {
} }
if (!btn.play){ if (!btn.play){
btn.play = document.querySelector('[tutor-shot="play-btn"]') btn.play = document.querySelector('[tutor-shot="play-btn"]')
btn.play.addEventListener('click', startRecording) btn.play.addEventListener('click', resumeRecording)
} }
if (!btn.capture){ if (!btn.capture){
btn.capture = document.querySelector('[tutor-shot="capture-btn"]') btn.capture = document.querySelector('[tutor-shot="capture-btn"]')
btn.capture.addEventListener('click', startRecording) console.log('take screen shot')
} }
if (!btn.playText) btn.playText = document.querySelector('[tutor-shot="play-text"]') if (!btn.playText) btn.playText = document.querySelector('[tutor-shot="play-text"]')
if (!btn.pause){ if (!btn.pause){
...@@ -204,7 +206,7 @@ function reRenderFloatingBar(data) { ...@@ -204,7 +206,7 @@ function reRenderFloatingBar(data) {
} }
if (!btn.stop){ if (!btn.stop){
btn.stop = document.querySelector('[tutor-shot="stop-btn"]') btn.stop = document.querySelector('[tutor-shot="stop-btn"]')
btn.stop.addEventListener('clikc', stopRecording) btn.stop.addEventListener('click', stopRecording)
} }
if (!btn.restart){ if (!btn.restart){
btn.restart = document.querySelector('[tutor-shot="restart-btn"]') btn.restart = document.querySelector('[tutor-shot="restart-btn"]')
...@@ -224,7 +226,6 @@ function reRenderFloatingBar(data) { ...@@ -224,7 +226,6 @@ function reRenderFloatingBar(data) {
btn.stop.style.display = 'flex' btn.stop.style.display = 'flex'
btn.restart.style.display = 'flex' btn.restart.style.display = 'flex'
btn.capture.style.display = 'flex' btn.capture.style.display = 'flex'
btn.playText.innerHTML = 'CONTINUE'
} }
else if (data?.status == 'recording') { else if (data?.status == 'recording') {
btn.play.style.display = 'none' btn.play.style.display = 'none'
...@@ -239,7 +240,6 @@ function reRenderFloatingBar(data) { ...@@ -239,7 +240,6 @@ function reRenderFloatingBar(data) {
btn.stop.style.display = 'none' btn.stop.style.display = 'none'
btn.capture.style.display = 'none' btn.capture.style.display = 'none'
btn.restart.style.display = 'none' btn.restart.style.display = 'none'
btn.playText.innerHTML = 'START'
} }
// floatingBar.innerHTML = innerHTML // floatingBar.innerHTML = innerHTML
} }
...@@ -318,10 +318,15 @@ async function startRecording() { ...@@ -318,10 +318,15 @@ async function startRecording() {
async function pauseRecording(){ async function pauseRecording(){
console.log('to pause recording') console.log('to pause recording')
await chrome.runtime.sendMessage({action: "pauseRecording"})
}
async function resumeRecording(){
await chrome.runtime.sendMessage({action: "resumeRecording"})
} }
async function stopRecording(){ async function stopRecording(){
console.log('to stop recocrding') console.log('stop recording')
await chrome.runtime.sendMessage({action: "stopRecording"})
} }
async function restartRecording(){ async function restartRecording(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment