58 lines
1.1 KiB
Plaintext
58 lines
1.1 KiB
Plaintext
<template>
|
|
<div>
|
|
<button @click="startSearch"> 搜索投屏设备 </button>
|
|
<button @click="startPush"> 开始投屏 </button>
|
|
<button @click="stopPush"> 停止投屏 </button>
|
|
<button @click="pausePush"> 暂停 </button>
|
|
<button @click="resumePush"> 播放 </button>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
const ox = uni.requireNativePlugin('Jiang-OxePlayer');
|
|
var device;
|
|
export default {
|
|
onReady() {
|
|
console.log('44444444');
|
|
ox.initDlna();
|
|
var globalEvent = weex.requireModule('globalEvent');
|
|
globalEvent.addEventListener('dlnaCallback', function(e) {
|
|
console.log(e);
|
|
});
|
|
},
|
|
methods: {
|
|
|
|
startSearch: function() {
|
|
ox.startSearch(result => {
|
|
console.log(result);
|
|
if(result.code==0){
|
|
var ds =result.devices;
|
|
device = ds[0];
|
|
}
|
|
|
|
});
|
|
},
|
|
startPush: function() {
|
|
ox.startPush({
|
|
url: 'http://www.easydarwin.org/public/video/3/video.m3u8',
|
|
device: device
|
|
});
|
|
},
|
|
stopPush: function() {
|
|
ox.stopPush();
|
|
},
|
|
pausePush: function() {
|
|
ox.pause();
|
|
},
|
|
resumePush: function() {
|
|
ox.resume();
|
|
}
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
|
|
</style>
|