This plugin show example how to fetch media based on mediaId, which store as attribute in backend.
Download Plugin