MyBB Community Forums

Full Version: Custom videos in WYSIWYG
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I am trying to add support for Bilibili videos on the bbcodes_sceditor.js file.

This is what I currently have:
'Bilibili': {
'match': /https:\/\/www\.bilibili\.com\/video\/([^/]+)\/?/,
'url': '//player.bilibili.com/player.html?bvid=',
'html': '<iframe src="{url}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" ' +
' style="width: 640px; height: 430px; max-width: 100%" height="378" width="620" data-mybb-vt="{type}" data-mybb-vsrc="{src}"></iframe>'
}


One problem is, the url of a Bilibili video iframe is supposed to receive two parameters: aid and bvid. But here it appears I can only pass one parameter to it. Another problem is that the match could have two different types of URL, and the URL of the iframe depends on it.

For example, there can be these two different URLs for the same video:

https://www.bilibili.com/video/bv1EJ411s7ZG
https://www.bilibili.com/video/av80220911

One has bv in the ID prefix, and the other one has av in the ID prefix. For URLs with bv, the iframe url may have only bvid (and must have it). But for URLs with av, the iframe url may have only aid (and must have).