player.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div id="player">
  3. <div id="easyplayer"></div>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'player',
  9. data() {
  10. return {
  11. easyPlayer: null
  12. };
  13. },
  14. props: ['videoUrl', 'error', 'hasaudio'],
  15. mounted () {
  16. this.$nextTick(() =>{
  17. console.log("初始化时的地址为: " + this.videoUrl)
  18. this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK)
  19. this.easyPlayer.play(this.videoUrl, 1)
  20. })
  21. },
  22. watch:{
  23. videoUrl(newData, oldData){
  24. this.easyPlayer.destroy()
  25. this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK)
  26. this.easyPlayer.play(newData, 1)
  27. },
  28. immediate:true
  29. },
  30. methods: {
  31. play: function (url) {
  32. this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK)
  33. this.easyPlayer.play(url, 1)
  34. },
  35. pause: function () {
  36. this.easyPlayer.destroy();
  37. },
  38. eventcallbacK: function(type, message) {
  39. console.log("player 事件回调")
  40. console.log(type)
  41. console.log(message)
  42. }
  43. },
  44. }
  45. </script>
  46. <style>
  47. .LodingTitle {
  48. min-width: 70px;
  49. }
  50. /* 隐藏logo */
  51. /* .iconqingxiLOGO {
  52. display: none !important;
  53. } */
  54. </style>