How to insert audio player in the editor?

How to insert audio player in the editor? To make links (for example https://site/song.mp3) turn into a player.

You’ll need a new schema item that models the audio attributes and then renders the HTML audio element utilizing the state of the audio block. Have you created any custom schema yet?

Optionally, use you could also implement this with Node Views These allow full control of DOM nodes lifecycle. You’ll want to find any example of Node View to get started, but it could take you a few minutes to a half hour to figure out how render an audio player with attributes stored in the document. If a simple audio element works, then this is not needed.

Specifically to your question about converting a pasted link into this audio scheme item, that’ll require input rules (ProseMirror Reference manual) or code that examines all transactions for pasted text and then converts that text to an audio block.

It’s also possible you could use ParseDOM ProseMirror Reference manual, and then look for a tags with hrefs that end in .mp3 or some extension.