How to create a media object from image URL programatically

@Chandan_Pednekar
Was facing the same issue. you need to use the Id of the asset as the value for the field. Just like relations.