|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
<template> |
|
|
|
|
<div style="position: absolute;right: 0;bottom:0;width: 400px;border:1px solid #ccc"> |
|
|
|
|
|
|
|
|
|
<v-card class="d-inline-block mx-auto d-flex flex-row-reverse" v-if="show"> |
|
|
|
|
<v-container> |
|
|
|
|
<v-row> |
|
|
|
|
<v-col cols="12" md="10"> |
|
|
|
|
<v-file-input ref="file" id="myfile" accept="pdf" label="Please select a file"></v-file-input> |
|
|
|
@ -20,7 +20,8 @@ |
|
|
|
|
<v-btn v-if="pdf && !loading" @click="stop">stop pdf share</v-btn> |
|
|
|
|
</v-col> |
|
|
|
|
</v-row> |
|
|
|
|
</div> |
|
|
|
|
</v-container> |
|
|
|
|
</v-card> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
@ -43,10 +44,12 @@ export default { |
|
|
|
|
opaqueId:String |
|
|
|
|
}, |
|
|
|
|
data: () => ({ |
|
|
|
|
show: true, |
|
|
|
|
pdf: null, |
|
|
|
|
pageNumber: 1, |
|
|
|
|
loading: true, |
|
|
|
|
pluginHandle: null |
|
|
|
|
pluginHandle: null, |
|
|
|
|
intervalId: null |
|
|
|
|
}), |
|
|
|
|
mounted () { |
|
|
|
|
pdfjsLib.GlobalWorkerOptions.workerSrc = "/pdf.worker.js" |
|
|
|
@ -73,8 +76,9 @@ export default { |
|
|
|
|
|
|
|
|
|
var renderTask = page.render(renderContext); |
|
|
|
|
renderTask.promise.then( () => { |
|
|
|
|
if (!this.pluginHandle) { |
|
|
|
|
this.loading = false |
|
|
|
|
|
|
|
|
|
if (!this.pluginHandle) { |
|
|
|
|
// document.getElementById('pdfvid').srcObject = document.getElementById('mypdfview').captureStream(60) |
|
|
|
|
|
|
|
|
|
this.janusInit.attach( |
|
|
|
@ -102,19 +106,22 @@ export default { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
stop(){ |
|
|
|
|
this.onstop(); |
|
|
|
|
var unpublish = { "request": "unpublish"}; |
|
|
|
|
this.pluginHandle.send({"message": unpublish}); |
|
|
|
|
|
|
|
|
|
this.pluginHandle.detach(); |
|
|
|
|
|
|
|
|
|
// reset |
|
|
|
|
clearInterval(this.intervalId); |
|
|
|
|
this.pluginHandle = null; |
|
|
|
|
this.pdf = null; |
|
|
|
|
this.pageNumber = 1; |
|
|
|
|
this.loading = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// callback |
|
|
|
|
this.onstop(); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
janusPluginError (error) { |
|
|
|
|
console.log('error', error) |
|
|
|
@ -208,7 +215,7 @@ export default { |
|
|
|
|
// var pageNumber = 1; |
|
|
|
|
this.pdf = pdf |
|
|
|
|
this.loading = true |
|
|
|
|
setInterval(this.pdfTimer, 1000/15) |
|
|
|
|
this.intervalId = setInterval(this.pdfTimer, 1000/15) |
|
|
|
|
this.renderPage(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|