Commit 646f87846ee77d607a7824d537466027e8ae77a3

Authored by season
1 parent 75aec6ef

增加回放视频

app.json
1 { 1 {
2 "pages": [ 2 "pages": [
  3 + "pages/video/index",
3 "pages/index/index/index", 4 "pages/index/index/index",
4 "pages/goods/categoryList/categoryList", 5 "pages/goods/categoryList/categoryList",
5 "pages/cart/cart/cart", 6 "pages/cart/cart/cart",
@@ -83,19 +84,7 @@ @@ -83,19 +84,7 @@
83 "pages/user/assistance/assistance_success", 84 "pages/user/assistance/assistance_success",
84 "pages/user/assistance/assistance" 85 "pages/user/assistance/assistance"
85 86
86 - ],  
87 - "subPackages": [  
88 - {  
89 - "root": "packageA/",  
90 - "pages": [],  
91 - "plugins": {  
92 - "live-player-plugin": {  
93 - "version": "1.0.2",  
94 - "provider": "wx2b03c6e691cd7370"  
95 - }  
96 - }  
97 - }  
98 - ], 87 + ],
99 "permission": { 88 "permission": {
100 "scope.userLocation": { 89 "scope.userLocation": {
101 "desc": "获取你的位置信息" 90 "desc": "获取你的位置信息"
pages/video/index.js 0 → 100644
  1 +function getRandomColor () {
  2 + let rgb = []
  3 + for (let i = 0 ; i < 3; ++i){
  4 + let color = Math.floor(Math.random() * 256).toString(16)
  5 + color = color.length == 1 ? '0' + color : color
  6 + rgb.push(color)
  7 + }
  8 + return '#' + rgb.join('')
  9 +}
  10 +
  11 +Page({
  12 + onReady: function (res) {
  13 + this.videoContext = wx.createVideoContext('myVideo')
  14 + },
  15 + inputValue: '',
  16 + data: {
  17 + src: '',
  18 + danmuList: [
  19 + {
  20 + text: '第 1s 出现的弹幕',
  21 + color: '#ff0000',
  22 + time: 1
  23 + },
  24 + {
  25 + text: '第 3s 出现的弹幕',
  26 + color: '#ff00ff',
  27 + time: 3
  28 + }]
  29 + },
  30 + bindInputBlur: function(e) {
  31 + this.inputValue = e.detail.value
  32 + },
  33 + bindButtonTap: function() {
  34 + var that = this
  35 + wx.chooseVideo({
  36 + sourceType: ['album', 'camera'],
  37 + maxDuration: 60,
  38 + camera: ['front','back'],
  39 + success: function(res) {
  40 + that.setData({
  41 + src: res.tempFilePath
  42 + })
  43 + }
  44 + })
  45 + },
  46 + bindSendDanmu: function () {
  47 + this.videoContext.sendDanmu({
  48 + text: this.inputValue,
  49 + color: getRandomColor()
  50 + })
  51 + }
  52 +})
0 \ No newline at end of file 53 \ No newline at end of file
pages/video/index.json 0 → 100644
  1 +{
  2 + "navigationBarTitleText": "视频",
  3 + "enablePullDownRefresh": false
  4 +}
0 \ No newline at end of file 5 \ No newline at end of file
pages/video/index.wxml 0 → 100644
  1 +
  2 +<view class="video">
  3 + <video
  4 + src="http://1258344707.vod2.myqcloud.com/1b87576bvodcq1258344707/54fc82435285890799847056279/playlist_eof.m3u8"
  5 + controls
  6 + show-fullscreen-btn
  7 + show-mute-btn
  8 + bindplay = "play"
  9 + bindwaiting="waiting"
  10 + binderror="error"
  11 + bindpause="pause"
  12 + bindtimeupdate="timeupdate"></video>
  13 +
  14 +</view>
0 \ No newline at end of file 15 \ No newline at end of file
pages/video/index.wxss 0 → 100644
  1 +.page-body-button {
  2 + margin-bottom: 30rpx;
  3 +}
  4 +
  5 +video {
  6 + width: 100%;
  7 +}
0 \ No newline at end of file 8 \ No newline at end of file