|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<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-row> |
|
|
|
<v-col cols="12" md="10"> |
|
|
|
<v-col cols="12" md="10"> |
|
|
|
<v-file-input ref="file" id="myfile" accept="pdf" label="Please select a file"></v-file-input> |
|
|
|
<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-btn v-if="pdf && !loading" @click="stop">stop pdf share</v-btn> |
|
|
|
</v-col> |
|
|
|
</v-col> |
|
|
|
</v-row> |
|
|
|
</v-row> |
|
|
|
</div> |
|
|
|
</v-container> |
|
|
|
|
|
|
|
</v-card> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
@ -43,10 +44,12 @@ export default { |
|
|
|
opaqueId:String |
|
|
|
opaqueId:String |
|
|
|
}, |
|
|
|
}, |
|
|
|
data: () => ({ |
|
|
|
data: () => ({ |
|
|
|
|
|
|
|
show: true, |
|
|
|
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 +76,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( |
|
|
@ -102,19 +106,22 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
stop(){ |
|
|
|
stop(){ |
|
|
|
|
|
|
|
this.onstop(); |
|
|
|
var unpublish = { "request": "unpublish"}; |
|
|
|
var unpublish = { "request": "unpublish"}; |
|
|
|
this.pluginHandle.send({"message": unpublish}); |
|
|
|
this.pluginHandle.send({"message": unpublish}); |
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
this.loading = true; |
|
|
|
this.loading = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// callback |
|
|
|
// callback |
|
|
|
this.onstop(); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
janusPluginError (error) { |
|
|
|
janusPluginError (error) { |
|
|
|
console.log('error', error) |
|
|
|
console.log('error', error) |
|
|
@ -208,7 +215,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) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|