fixed: share pdf problems

master^2
Tuğrul Gençoğlu 5 years ago
parent 72d7f79477
commit fad85d6021
  1. 15
      src/lib/PdfShare.vue
  2. 2
      src/lib/VueJanus.vue

@ -43,10 +43,11 @@ export default {
opaqueId:String opaqueId:String
}, },
data: () => ({ data: () => ({
pdf:null, pdf: null,
pageNumber:1, pageNumber: 1,
loading:true, loading: true,
pluginHandle: null pluginHandle: null,
intervalId: null
}), }),
mounted () { mounted () {
pdfjsLib.GlobalWorkerOptions.workerSrc = "/pdf.worker.js" pdfjsLib.GlobalWorkerOptions.workerSrc = "/pdf.worker.js"
@ -73,8 +74,9 @@ export default {
var renderTask = page.render(renderContext); var renderTask = page.render(renderContext);
renderTask.promise.then( () => { renderTask.promise.then( () => {
if (!this.pluginHandle) {
this.loading = false this.loading = false
if (!this.pluginHandle) {
// document.getElementById('pdfvid').srcObject = document.getElementById('mypdfview').captureStream(60) // document.getElementById('pdfvid').srcObject = document.getElementById('mypdfview').captureStream(60)
this.janusInit.attach( this.janusInit.attach(
@ -108,6 +110,7 @@ export default {
this.pluginHandle.detach(); this.pluginHandle.detach();
// reset // reset
clearInterval(this.intervalId);
this.pluginHandle = null; this.pluginHandle = null;
this.pdf = null; this.pdf = null;
this.pageNumber = 1; this.pageNumber = 1;
@ -208,7 +211,7 @@ export default {
// var pageNumber = 1; // var pageNumber = 1;
this.pdf = pdf this.pdf = pdf
this.loading = true this.loading = true
setInterval(this.pdfTimer, 1000/15) this.intervalId = setInterval(this.pdfTimer, 1000/15)
this.renderPage(1) this.renderPage(1)

@ -1,7 +1,7 @@
<template> <template>
<v-container fill-height> <v-container fill-height>
<PdfShare v-if="sharePdf" :username="username" :opaque-id="opaqueId" :room="room" :janus-init="janusInit" ></PdfShare> <PdfShare v-if="sharePdf" :username="username" :opaque-id="opaqueId" :room="room" :onstop="stopSharePdf" :janus-init="janusInit" ></PdfShare>
<v-dialog <v-dialog
v-model="mozillaAlert" v-model="mozillaAlert"
max-width="600" max-width="600"