123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- Component({
- options: {
- multipleSlots: true,
- },
-
- properties: {
- options: null,
- },
-
- lifetimes: {
- attached: function () {
-
- this.videoContext = wx.createVideoContext("myVideo");
- if (this.data.autoplay) {
- this.setData({
- play: false,
- });
- }
- console.log(this.data.play);
- },
- detached: function () {
-
- },
- },
-
- attached: function () {
-
- },
- detached: function () {
-
- },
- ready: function () {
-
- this.loadData();
- },
- data: {
- style: null,
- vdata: null,
- list: [],
- },
-
- methods: {
- async loadData() {
- let { options } = this.data;
- console.log("视频组", options);
- let { data, style, cloumn } = options;
- let { src, list } = data;
- this.setData({
- list,
- src,
- style,
- cloumn,
- vdata: data,
- });
- },
- bindButtonTap() {
- const that = this;
- wx.chooseVideo({
- sourceType: ["album", "camera"],
- maxDuration: 60,
- camera: ["front", "back"],
- success(res) {
- that.setData({
- src: res.tempFilePath,
- });
- },
- });
- },
- videoTap: function (e) {
-
- let { play } = this;
- this.videoContext = wx.createVideoContext("myVideo", this);
- if (this.data.play) {
-
- this.videoContext.play();
- this.setData({
- play: false,
- });
- } else {
-
- this.videoContext.pause();
- this.setData({
- play: true,
- });
- }
- },
- bindPlayVideo() {
- console.log("1");
- this.videoContext.play();
- },
- videoErrorCallback(e) {
- console.log("视频错误信息:");
- console.log(e.detail.errMsg);
- },
- },
- });
|