index.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // index.js
  2. // 获取应用实例
  3. const app = getApp()
  4. wx.setNavigationBarColor({
  5. frontColor: '#ffffff',
  6. backgroundColor: '#ff0000',
  7. })
  8. const urls = [
  9. 'https://4dkk2.4dage.com/swipe-video-test/1.MP4',
  10. 'https://4dkk2.4dage.com/swipe-video-test/2.MP4',
  11. 'https://4dkk2.4dage.com/swipe-video-test/3.MP4',
  12. 'https://4dkk2.4dage.com/swipe-video-test/4.MP4',
  13. 'https://4dkk2.4dage.com/swipe-video-test/5.MP4',
  14. 'https://4dkk2.4dage.com/swipe-video-test/6.MP4',
  15. 'https://4dkk2.4dage.com/swipe-video-test/7.MP4',
  16. 'https://4dkk2.4dage.com/swipe-video-test/8.MP4',
  17. 'https://4dkk2.4dage.com/swipe-video-test/9.MP4',
  18. 'https://4dkk2.4dage.com/swipe-video-test/10.MP4',
  19. 'https://4dkk2.4dage.com/swipe-video-test/11.MP4',
  20. 'https://4dkk2.4dage.com/swipe-video-test/12.MP4',
  21. 'https://4dkk2.4dage.com/swipe-video-test/13.MP4',
  22. 'https://4dkk2.4dage.com/swipe-video-test/14.MP4',
  23. ]
  24. const videoList = urls.map((url, index) => ({
  25. id: index + 1,
  26. url,
  27. objectFit: 'cover'
  28. }))
  29. console.log('videoList', videoList)
  30. Page({
  31. data: {
  32. videoList,
  33. targetPlayIndex: -1
  34. },
  35. onLoad() {
  36. // setTimeout(() => {
  37. // this.setData({
  38. // targetPlayIndex: 6
  39. // })
  40. // console.log('指向播放')
  41. // }, 3000)
  42. },
  43. // 事件处理函数
  44. onPlay(e) {},
  45. onPause(e) {
  46. // console.log('pause', e.detail.activeId)
  47. },
  48. onEnded(e) {},
  49. onError(e) {},
  50. onWaiting(e) {},
  51. onTimeUpdate(e) {},
  52. onProgress(e) {},
  53. onLoadedMetaData(e) {
  54. // console.log('LoadedMetaData', e)
  55. },
  56. onChange(e) {
  57. // console.log('onChange', e.detail)
  58. }
  59. })