Videoplayback.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="shipin">
  3. <!-- <div id="video-container" class="myplayer" ref="myPlayer"></div> -->
  4. <web-view :src="url"></web-view>
  5. </view>
  6. </template>
  7. <script>
  8. // import EZUIKit from "../../../../static/ezuikit.js";
  9. // var player = null;
  10. export default {
  11. data() {
  12. return {
  13. urls:'',
  14. width:'',
  15. }
  16. },
  17. onLoad(options) {
  18. this.urls = options.companyOrgId;
  19. // this.accessToken();
  20. this.width = uni.getSystemInfoSync().screenWidth;
  21. // console.log('111111111111111111', uni.getSystemInfoSync().screenWidth)
  22. },
  23. onShow() {
  24. this.selectVideoValue();
  25. },
  26. methods: {
  27. selectVideoValue(){
  28. var postdata ={
  29. 'appKey': 'bf1fe258e25b4556af2889b53cf2d835',
  30. 'appSecret': 'f814b3ce1653f7f909b6ccc358563fb3'
  31. };
  32. uni.request({
  33. url:'https://open.ys7.com/api/lapp/token/get',
  34. method: "POST",
  35. data: postdata,
  36. header: {
  37. 'content-type': 'application/x-www-form-urlencoded',
  38. },
  39. success: (res) => {
  40. // console.log('111111111111111111',res.data.data.accessToken)
  41. let that = this;
  42. // var currentWebview = this.$scope.$getAppWebview()
  43. // setTimeout(function() {
  44. that.url = "../../../../static/sp.html?url="+ this.urls+"&accessToken="+res.data.data.accessToken;
  45. // var wv = currentWebview.children()[0]
  46. // wv.setStyle({
  47. // top:200,
  48. // height:400,
  49. // })
  50. // }, 500);
  51. }
  52. });
  53. },
  54. accessToken(){
  55. var postdata ={
  56. 'appKey': 'bf1fe258e25b4556af2889b53cf2d835',
  57. 'appSecret': 'f814b3ce1653f7f909b6ccc358563fb3'
  58. };
  59. console.log('111111111111111111',postdata)
  60. uni.request({
  61. url:'https://open.ys7.com/api/lapp/token/get',
  62. method: "POST",
  63. data: postdata,
  64. header: {
  65. 'content-type': 'application/x-www-form-urlencoded',
  66. },
  67. success: (res) => {
  68. console.log('111111111111111111',res.data.data.accessToken)
  69. player = new EZUIKit.EZUIKitPlayer({
  70. id: 'video-container', // 视频容器ID
  71. accessToken: res.data.data.accessToken,
  72. url:this.urls,
  73. template: 'simple',
  74. plugin: ['talk'], // 加载插件,talk-对讲
  75. width:this.width,
  76. height: 250,
  77. autoplay: true,
  78. // decoderPath: EZUIKit,
  79. });
  80. window.player = player;
  81. }
  82. });
  83. }
  84. }
  85. }
  86. </script>
  87. <style>
  88. .shipin{
  89. width: 750rpx;
  90. height: 100%;
  91. }
  92. #video-container{
  93. width: 750rpx;
  94. height: 600rpx;
  95. }
  96. </style>