CMS Lightbox picks the media between main project image or a video

Hi guys,

So in the work page there are 3 tabs containing CMS content from work and the 3 categories are ALL, VIDEOS and IMAGES. Im using lightboxes and for all i need the light box to pull the media from projects. However the issue is that the media only open either photos or videos i need it to be able to recognize if the lightbox has a video link it should open the video and if not it should open the main image. Any input helps !

Here is my public share link: