How to remove media in the mediapool ?

Rosebud wrote on 1/29/2008, 5:46 PM
I’m trying to replace some media in the mediapool by some other media.
I use this code:
media.ReplaceWith(new Media(file));

It works fine.
However, the original media is not removed from the mediapool.
I tried the “MediaPool.Remove(media)” method, but I can’t get it to work.

Thx for your help.

Comments

jetdv wrote on 1/29/2008, 6:10 PM
Would you not need to remove from the actual bin?

MediaPool.RootMediaBin.Remove(media)
Rosebud wrote on 1/30/2008, 1:47 AM
Thx Edward,

I tried this too, but I got an error.

My media are located in a bin named “Converted files”
The code I tried is:

Media newMedia = new Media(file);
media.ReplaceWith(newMedia);
myVegas.Project.MediaPool.RootMediaBin.Remove(media);

With this code I got this error.


With the following code, I got no error but the media are not removed:

Media newMedia = new Media(file);
media.ReplaceWith(newMedia);
myVegas.Project.MediaPool.Remove(media);

Rosebud wrote on 1/30/2008, 3:53 AM
Problem solved, the right code is :
myVegas.Project.MediaPool.Remove(media.KeyString);