Wechat applet wxparse plug-in display video

Time:2019-11-17

Modify the wxparse / html2json.js file in the html2json (HTML, bindname) method

 

  var node = {
                node: 'element',
                tag: tag,
            };

Here, use node.tag to get the label type, such as img, embed, video

Here my system background editor uses the ckedit to upload the video. The generated note is: Embed

So add judgment:

       if (node.tag =="embed"){

          
            var embUrl = node.attr.src;
            if (node.attr.src.indexOf('http:')==-1){
              embUrl = "http://xxxx.com" + node.attr.src; 
            }
            node.attr.src = embUrl;
            node.tag='video';
          }

 

In the plug-in, only the video tag is judged, and the embedded tag is not recognized. All videos cannot be displayed. Add the judgment, and then it will be OK.