Conditional formating in search display template sharepoint online

Is there any way we can change the property “data-displaytemplate” in search display template based up on condition of the current item .

For example when i Hover an item in search i want to display video thumbnail if it is of type Video and similarly Image if it is of type in my custom display template i have to use bothe Image and Video types .. Any help is much Appreciated