Videoplayback.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="shipin">
  3. <div id="video-container" class="myplayer" ref="myPlayer" @click="noclick"></div>
  4. </view>
  5. </template>
  6. <script>
  7. import EZUIKit from "../../../../utils/ezuikit.js";
  8. var player = null;
  9. export default {
  10. data() {
  11. return {
  12. urls:'',
  13. width:'',
  14. }
  15. },
  16. onLoad(options) {
  17. this.urls = options.companyOrgId;
  18. console.log( this.urls);
  19. this.accessToken();
  20. this.width = uni.getSystemInfoSync().screenWidth;
  21. console.log('111111111111111111', uni.getSystemInfoSync().screenWidth)
  22. },
  23. methods: {
  24. accessToken(){
  25. var postdata ={
  26. 'appKey': 'bf1fe258e25b4556af2889b53cf2d835',
  27. 'appSecret': 'f814b3ce1653f7f909b6ccc358563fb3'
  28. };
  29. uni.request({
  30. url:'https://open.ys7.com/api/lapp/token/get',
  31. method: "POST",
  32. data: postdata,
  33. header: {
  34. 'content-type': 'application/x-www-form-urlencoded',
  35. },
  36. success: (res) => {
  37. // console.log('111111111111111111',res.data.data.accessToken)
  38. player = new EZUIKit.EZUIKitPlayer({
  39. id: 'video-container', // 视频容器ID
  40. accessToken: res.data.data.accessToken,
  41. url:this.urls,
  42. // simple - 极简版; pcLive-pc直播;pcRec-pc回放;mobileLive-移动端直播;mobileRec-移动端回放;security - 安防版;voice-语音版;
  43. template: 'simple',
  44. plugin: ['talk'], // 加载插件,talk-对讲
  45. width:this.width,
  46. height: 250,
  47. autoplay: true,
  48. // decoderPath: EZUIKit,
  49. });
  50. window.player = player;
  51. }
  52. });
  53. }
  54. }
  55. }
  56. </script>
  57. <style>
  58. .shipin{
  59. width: 750rpx;
  60. height: 100%;
  61. }
  62. #video-container{
  63. width: 750rpx;
  64. height: 600rpx;
  65. }
  66. </style>