kuaishou.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. declare namespace UniApp {
  2. interface ks {
  3. /**
  4. * 登录
  5. *
  6. * 文档: [https://mp.kuaishou.com/docs/develop/api-next/open/payment/ks.pay.html#ks-pay)
  7. */
  8. pay(options: PayOptions): void;
  9. createVideoContext(videoId: string, currentComponent?: any): VideoContext;
  10. }
  11. }
  12. interface PayOptions {
  13. orderInfo: object,
  14. service: number,
  15. /**
  16. * 接口调用成功的回调函数
  17. */
  18. success?: (result: any) => void;
  19. /**
  20. * 接口调用失败的回调函数
  21. */
  22. fail?: (result: any) => void;
  23. /**
  24. * 接口调用结束的回调函数(调用成功、失败都会执行)
  25. */
  26. complete?: (result: any) => void;
  27. }
  28. interface VideoContext {
  29. /**
  30. * 暂停
  31. */
  32. pause(): void;
  33. /**
  34. * 播放
  35. */
  36. play(): void;
  37. /**
  38. * 跳转到指定位置,单位 s
  39. */
  40. seek(position: number): void;
  41. /**
  42. * 发送弹幕,danmu 包含两个属性 text, color。
  43. */
  44. sendDanmu(danmu: Danmu): void;
  45. /**
  46. * 设置倍速播放,支持的倍率有 0.5/0.8/1.0/1.25/1.5
  47. */
  48. playbackRate(rate: number): void;
  49. /**
  50. * 进入全屏,可传入{direction}参数(1.7.0起支持),详见video组件文档
  51. */
  52. requestFullScreen(direction?: RequestFullScreenOptions): void;
  53. /**
  54. * 退出全屏
  55. */
  56. exitFullScreen(): void;
  57. }
  58. /**
  59. * Uni 实例变量
  60. *
  61. * 文档: [http://uniapp.dcloud.io/api](http://uniapp.dcloud.io/api)
  62. */
  63. declare let ks: UniApp.ks;