live.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { layerNameOption, positionConfig } from './base'
  2. export default {
  3. type: 'CLive',
  4. label: '直播',
  5. icon: 'el-icon-video-camera',
  6. defaults (scale) {
  7. return {
  8. top: 0,
  9. left: 0,
  10. width: 300 * scale.width | 0,
  11. height: 200 * scale.height | 0,
  12. radius: 0,
  13. mute: 1,
  14. url: ''
  15. }
  16. },
  17. copy ({ mute, ...widget }) {
  18. widget.mute = 1
  19. return widget
  20. },
  21. options: [
  22. {
  23. label: '配置',
  24. list: [
  25. layerNameOption,
  26. {
  27. key: 'radius',
  28. label: '圆角',
  29. type: 'number'
  30. },
  31. {
  32. key: 'mute',
  33. label: '音频输出',
  34. type: 'boolean',
  35. options: {
  36. display (root) {
  37. return !root.bgm.length
  38. },
  39. callback (root) {
  40. if (!this.mute) {
  41. root.widgets.forEach(widget => {
  42. if (widget.mute === 0 && widget !== this) {
  43. widget.mute = 1
  44. }
  45. })
  46. }
  47. },
  48. active: 0,
  49. inactive: 1
  50. }
  51. },
  52. {
  53. key: 'url',
  54. label: '直播地址',
  55. type: 'textarea',
  56. options: {
  57. singleLine: true
  58. }
  59. }
  60. ]
  61. },
  62. positionConfig
  63. ]
  64. }