mediasession.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. /**
  5. * @fileoverview The current spec of the Media Session API.
  6. * @see https://wicg.github.io/mediasession/
  7. * @externs
  8. */
  9. /**
  10. * @see https://wicg.github.io/mediasession/#the-mediaimage-dictionary
  11. * @record
  12. * @struct
  13. */
  14. function MediaImage() {}
  15. /** @type {string} */
  16. MediaImage.prototype.src;
  17. /** @type {(string|undefined)} */
  18. MediaImage.prototype.sizes;
  19. /** @type {(string|undefined)} */
  20. MediaImage.prototype.type;
  21. /**
  22. * A MediaMetadata object is a representation of the metadata associated with a
  23. * MediaSession that can be used by user agents to provide customized user
  24. * interface.
  25. * @see https://wicg.github.io/mediasession/#the-mediametadata-interface
  26. * @constructor
  27. * @param {?MediaMetadataInit} init
  28. */
  29. function MediaMetadata(init) {}
  30. /** @type {string} */
  31. MediaMetadata.prototype.album;
  32. /** @type {string} */
  33. MediaMetadata.prototype.artist;
  34. /** @type {!Array<!MediaImage>} */
  35. MediaMetadata.prototype.artwork;
  36. /** @type {string} */
  37. MediaMetadata.prototype.title;
  38. /**
  39. * @see https://wicg.github.io/mediasession/#the-mediametadata-interface
  40. * @record
  41. * @struct
  42. */
  43. function MediaMetadataInit() {}
  44. /** @type {(string|undefined)} */
  45. MediaMetadataInit.prototype.album;
  46. /** @type {(string|undefined)} */
  47. MediaMetadataInit.prototype.artist;
  48. /** @type {(!Array<!MediaImage>|undefined)} */
  49. MediaMetadataInit.prototype.artwork;
  50. /** @type {(string|undefined)} */
  51. MediaMetadataInit.prototype.title;
  52. /**
  53. * A MediaSession objects represents a media session for a given document and
  54. * allows a document to communicate to the user agent some information about the
  55. * playback and how to handle it.
  56. * @see https://wicg.github.io/mediasession/#the-mediasession-interface
  57. * @interface
  58. * @struct
  59. */
  60. function MediaSession() {}
  61. /** @type {?MediaMetadata} */
  62. MediaSession.prototype.metadata;
  63. /** @type {string} */
  64. MediaSession.prototype.playbackState;
  65. /** @type {function(string, ?function())} */
  66. MediaSession.prototype.setActionHandler;
  67. /** @type {?MediaSession} */
  68. Navigator.prototype.mediaSession;