Videoplayback.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="shipin">
  3. <web-view :src="url"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. // import EZUIKit from "../../../../static/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. // this.accessToken();
  19. // this.width = uni.getSystemInfoSync().screenWidth;
  20. // console.log('111111111111111111', uni.getSystemInfoSync().screenWidth)
  21. },
  22. onShow() {
  23. this.selectVideoValue();
  24. },
  25. methods: {
  26. selectVideoValue(){
  27. var postdata ={
  28. 'appKey': 'bf1fe258e25b4556af2889b53cf2d835',
  29. 'appSecret': 'f814b3ce1653f7f909b6ccc358563fb3'
  30. };
  31. uni.request({
  32. url:'https://open.ys7.com/api/lapp/token/get',
  33. method: "POST",
  34. data: postdata,
  35. header: {
  36. 'content-type': 'application/x-www-form-urlencoded',
  37. },
  38. success: (res) => {
  39. // console.log('111111111111111111',res.data.data.accessToken)
  40. // let that = this;
  41. this.url = "../../../../static/sp.html?url="+ this.urls+"&accessToken="+res.data.data.accessToken;
  42. }
  43. });
  44. },
  45. accessToken(){
  46. var postdata ={
  47. 'appKey': 'bf1fe258e25b4556af2889b53cf2d835',
  48. 'appSecret': 'f814b3ce1653f7f909b6ccc358563fb3'
  49. };
  50. console.log('111111111111111111',postdata)
  51. uni.request({
  52. url:'https://open.ys7.com/api/lapp/token/get',
  53. method: "POST",
  54. data: postdata,
  55. header: {
  56. 'content-type': 'application/x-www-form-urlencoded',
  57. },
  58. success: (res) => {
  59. console.log('111111111111111111',res.data.data.accessToken)
  60. player = new EZUIKit.EZUIKitPlayer({
  61. id: 'video-container', // 视频容器ID
  62. accessToken: res.data.data.accessToken,
  63. url:this.urls,
  64. template: 'simple',
  65. plugin: ['talk'], // 加载插件,talk-对讲
  66. width:this.width,
  67. height: 250,
  68. autoplay: true,
  69. // decoderPath: EZUIKit,
  70. });
  71. window.player = player;
  72. }
  73. });
  74. }
  75. },
  76. //监听页面卸载
  77. onUnload(){
  78. },
  79. }
  80. </script>
  81. <style>
  82. .shipin{
  83. width: 750rpx;
  84. height: 100%;
  85. }
  86. #video-container{
  87. width: 750rpx;
  88. height: 600rpx;
  89. }
  90. </style>