classvideo.vue 856 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view>
  3. <back text="课程直播"></back>
  4. <view class="video-box">
  5. <video class="video" id="classVideo" :src="video" @error="videoErrorCallback" controls></video>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. video: 'https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4',
  14. };
  15. },
  16. onLoad() {
  17. this.videoContext = uni.createVideoContext('classVideo')
  18. },
  19. methods: {
  20. videoErrorCallback(e) {
  21. uni.showModal({
  22. content: e.target.errMsg,
  23. showCancel: false
  24. })
  25. },
  26. }
  27. }
  28. </script>
  29. <style lang="scss">
  30. .video-box {
  31. width: 100%;
  32. .video {
  33. width: 100%;
  34. }
  35. }
  36. </style>