AnonMP4
Forum Integration

Add AnonMP4 uploads
to your forum

Drop an "Upload Video" button into your forum's reply editor. Users upload directly to AnonMP4 — the video embeds automatically in their post.

Quick start — 2 steps No server-side code needed Works on XenForo, phpBB, vBulletin, MyBB & more

How it works

1

User clicks "Upload Video"

A small popup opens with the AnonMP4 upload interface.

2

Video uploads to AnonMP4

The file is sent to anonmp4api.xyz. No storage on your server.

3

Embed inserts automatically

The bridge script places the embed code into the editor. The popup closes.

1

Add the button + bridge script

Each script adds an "Upload Video" button — clicking it opens a file picker, uploads directly to anonmp4api.xyz/upload, then inserts the embed into the editor.

XenForo — Admin CP → Appearance → Templates → PAGE_CONTAINER
<script type="text/javascript">
  // ─── AnonMP4 Upload Bridge for XenForo ────────────────────────────────
  // Adds an "Upload Video" button to the reply editor toolbar.
  // Change 'formButtonGroup-extra' if your theme uses a different container.

  window.addEventListener('load', function () {
    var toolbar = document.getElementsByClassName('formButtonGroup-extra');
    if (toolbar.length > 0) {
      toolbar[0].insertAdjacentHTML('beforeend',
        '<div class="formButtonGroup">' +
          '<button onclick="anonmp4PickFile()" type="button" tabindex="-1"' +
                  ' class="button--link button button--icon">' +
            '<i class="fa fa-video-camera"></i>' +
            '<span class="button-text">Upload Video</span>' +
          '</button>' +
        '</div>'
      );
    }
  });

  function anonmp4PickFile() {
    var input = document.createElement('input');
    input.type   = 'file';
    input.accept = 'video/*';
    input.onchange = function () {
      var file = input.files[0];
      if (!file) return;
      anonmp4Upload(file);
    };
    input.click();
  }

  function anonmp4Upload(file) {
    var form = new FormData();
    form.append('file', file);

    // Show status in the editor area
    var statusId = 'anonmp4-status-' + Date.now();
    anonmp4InsertBB('\n[Uploading ' + file.name + '...]\n', statusId);

    fetch('https://anonmp4api.xyz/upload', { method: 'POST', body: form })
      .then(function (res) { return res.json(); })
      .then(function (result) {
        var statusEl = document.getElementById(statusId);
        if (result.success) {
          // Insert [MEDIA=anonmp4]VIDEO_ID[/MEDIA] — matches the Media Site in Step 2
          var bbCode = '[MEDIA=anonmp4]' + result.video_id + '[/MEDIA]';
          if (statusEl) {
            statusEl.textContent = bbCode;
          } else {
            anonmp4InsertBB('\n' + bbCode + '\n');
          }
        } else {
          if (statusEl) statusEl.textContent = '[Upload failed: ' + result.error.message + ']';
        }
      })
      .catch(function (err) {
        console.error('[AnonMP4] Upload error:', err);
      });
  }

  function anonmp4InsertBB(text, markId) {
    // Try rich (Froala) editor first
    var richEl = document.getElementsByClassName('fr-element');
    if (richEl.length > 0) {
      var p = document.createElement('p');
      p.textContent = text;
      if (markId) p.id = markId;
      richEl[0].appendChild(p);
      return;
    }
    // Fall back to plain BB code textarea
    var boxes = document.querySelectorAll('[aria-label="Rich text box"], textarea[name="message"]');
    if (boxes.length > 0) {
      var pos = boxes[0].value.length;
      boxes[0].value += text;
      if (markId) boxes[0].dataset['anonmp4_mark_' + markId] = pos;
    }
  }
</script>

If the button doesn't appear, your theme's editor toolbar uses a different container class. Inspect the reply editor → find the row of action buttons → swap formButtonGroup-extra with that class name.

2

Add the AnonMP4 Media Site

Registers the [MEDIA=anonmp4] BBCode so XenForo renders the embed automatically

XenForo — Admin CP → Content → BB code media sites → Add Media Site
Site title   = AnonMP4
Media site ID = anonmp4
Site URL     = https://anonmp4.to
Match URLs   = https://anonmp4.help/embed/{$id}
             = https://anonmp4.help/v/{$id}

── Embed template ──────────────────────────────────────────────────────
<div style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
  <iframe
    src="https://anonmp4.help/embed/{$id}"
    style="position:absolute;top:0;left:0;width:100%;height:100%;border:none;"
    allow="fullscreen"
    loading="lazy"
    allowfullscreen>
  </iframe>
</div>

Once saved, whenever the bridge script inserts [MEDIA=anonmp4]VIDEO_ID[/MEDIA] into a post, XenForo will render a full responsive embed using the template above.

Other use cases

The bridge script is intentionally lightweight and reusable. The same postMessage pattern works anywhere you can run JavaScript:

Custom editor / website

Change the insertion logic to write to a textarea, contenteditable, or any input field. Point event.data.watch_url to get the direct link instead of the BBCode embed.

No BBCode? Use a direct link or iframe

If your platform doesn't support BBCode embeds, skip Step 2. Instead insert the watch_url as a plain hyperlink, or an <iframe src="https://anonmp4.help/embed/VIDEO_ID"> directly into the editor.

Button not showing up?

Inspect your forum's reply editor toolbar and find the container element around the existing buttons. Replace the class name in the script with the correct selector. The rest of the logic stays the same.

Need help with your setup?

Paste your forum name and the HTML of your editor toolbar, and we'll tailor the selector for your theme.

Contact Support