Just a quick example for code that imo is a little easier to follow

   var types = activity.source.data.type || 'image/jpeg';
   if (typeof types === 'string') { 
     types = [types];
   }

   var modes = { 'image': false, 'video': false};
   activity.source.data.type.forEach(function(type) {
      var typePrefix = type.split('/'); 
      modes[typePrefix] = true;
   });

   if (modes.image && modes.video) { 
      .. Enabled Switch