PlayerSource.js 835 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Model, Collection } from 'js-abstract-model'
  2. class PlayerSource extends Model {
  3. constructor (data) {
  4. super(data, [
  5. {
  6. key: 'src',
  7. default: ''
  8. },
  9. {
  10. key: 'type',
  11. default: 'video/mp4'
  12. },
  13. {
  14. key: 'label',
  15. default: ''
  16. },
  17. {
  18. key: 'caption',
  19. default: ''
  20. },
  21. {
  22. key: 'link',
  23. default: ''
  24. },
  25. {
  26. key: 'res',
  27. default: ''
  28. },
  29. {
  30. key: 'selected',
  31. default: false
  32. }
  33. ])
  34. if (!this.label && this.res) {
  35. this.label = this.res
  36. }
  37. if (!this.src && this.link) {
  38. this.src = this.link
  39. }
  40. }
  41. }
  42. class PlayerSourceList extends Collection {
  43. model () {
  44. return PlayerSource
  45. }
  46. }
  47. export { PlayerSource, PlayerSourceList }