|
@@ -9,6 +9,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import { getVideoUrl, getAppToken } from '@/api/hkws'
|
|
|
export default {
|
|
|
name: 'Capture',
|
|
|
props: {
|
|
@@ -16,6 +17,10 @@ export default {
|
|
|
type: String,
|
|
|
default: ''
|
|
|
},
|
|
|
+ type: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
data: {
|
|
|
type: Object,
|
|
|
default: () => {
|
|
@@ -24,7 +29,9 @@ export default {
|
|
|
szIP: '', // protocol ip
|
|
|
szPort: '', // protocol port
|
|
|
szUsername: '', // device username
|
|
|
- szPassword: '' // device password
|
|
|
+ szPassword: '', // device password
|
|
|
+ token: '',
|
|
|
+ transWeightCameraSerialnum: ''
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -41,6 +48,10 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
iframeLoaded() {
|
|
|
+ if (this.type === '1') {
|
|
|
+ this.loadWebUrl()
|
|
|
+ return
|
|
|
+ }
|
|
|
const item = this.data
|
|
|
if (this.isNull(item.transWeightCameraSocketAddr)) {
|
|
|
console.error('未配置推流地址')
|
|
@@ -80,6 +91,20 @@ export default {
|
|
|
this.state = true
|
|
|
this.iframeSrc = `${streamServeUrl}?name=${szUsername}&pwd=${szPassword}&ip=${szIP}&port=${szPort}`
|
|
|
},
|
|
|
+ // 在线地址获取deviceSerial
|
|
|
+ async loadWebUrl() {
|
|
|
+ const res = await getAppToken({
|
|
|
+ appKey: '054d5877d95646c0a461342d4c379e88',
|
|
|
+ appSecret: 'bd8ef0c40f6536161910c8566e340f0a'
|
|
|
+ })
|
|
|
+ getVideoUrl({
|
|
|
+ accessToken: res.accessToken,
|
|
|
+ deviceSerial: this.data.transWeightCameraSerialnum,
|
|
|
+ quality: 2
|
|
|
+ }).then((resq) => {
|
|
|
+ this.iframeSrc = `https://open.ys7.com/ezopen/h5/iframe?url=${resq.url}&autoplay=1&accessToken=${res.accessToken}`
|
|
|
+ })
|
|
|
+ },
|
|
|
isNull(val) {
|
|
|
if (val === undefined || val === 'undefined' && val === null && val === '') {
|
|
|
return true
|