## Extend Media Library

Question

The Media Library in WordPress has “Insert from URL” link to the left. It accepts image URLs. It’s not said anywhere but if you paste YouTube URL or <iframe> code then it will insert it too. It just won’t show the preview like it does with image URLs so you can’t tell if the code you typed in is valid or not.

1. I’d like to edit this page and make it show previews of valid WordPress Embeds and of valid <iframes>. I want it to just show basic information that the embed code was recognized, is valid and can be inserted. I can write all the AJAX requests to validate URLs but I need help with wp.media object. I have no idea how to update that page or replace it with my own page? So far I’ve found /wp-includes/js/media-editor.js where on line 1054 it says Called when 'Insert From URL' source is not an image. Example: YouTube url..
2. Secondly, once it’s already done, I’d like to be able to call something like the following piece of code to open the Media Library with “Insert from URL” page selected and with the code added (for users to modify the existing code).

The code (this is a working example of how to bring a window for editing images but I need this for “Insert from URL”):

frame = wp.media({
frame: 'image',
state: 'image-details',