How can I update my inline video/audio/image via `cm.markText` after I have updated the token?

The easiest way is to just check where the first of the changes is and re-scan lines around that. It is also in principle possible to construct a precise changed range from an array of changes, but since the change representation is really bad in this version, that is much more tricky than it should be. (CodeMirror 6 is a lot better about things like this.)