I’m creating a custom module using the Video Player and trying to figure out how to extract the values for the Player ID and the Form ID. I.e. I want the user to be able to select the video from the file manager and the form from the form list. But I can’t figure out how to reference the needed values from these selectors. This is what I have so far. Any help would be greatly appreciated!
Hi @beyhlh (thanks @sharonlicari). Your video_file field is actually a File field instead of a video field. If you change it for a video field
module.video_field.player_id
will work.
The form_id is correct, however, I tried it and it didn’t work even with the id hardcoded into it instead of the HubL variable so I don’t know what’s wrong there. It might be something wrong with the Vidyard/Hubspot integration. @dennisedson do you know anything about it?
@piersg, thank you for pointing out the field difference. I felt like what I was trying to create should have been built in - and it was! @dennisedson - When I try the setup using the snippet from the video field and select form as the overlay option, none of my forms are showing up in the section field. Is this the issue you’re seeing as well?
@beyhlh If the Vidyard conversion asset isn’t working, you could do it yourself with JS using the Vidyard Player API. Their API is built in to the embed code.
e.g. the below. I would add the form in the HubL but hidden. Wrapped in a div something like:
<div class="hide" id="my-form">
{# form code here #}
</div>
and then this code to your JS for the module.
let form = document.getElementById('my-form');
function onVideoCompletion(vidyardEmbed) {
vidyardEmbed.api.progressEvents(function (result) {
// code here to show popup or add your form to the page in some way
form.classList.remove('hide');
// 100 below means 100% of the video, i.e. the action above will happen at the end of the video
}, [100]);
}
window.vidyardEmbed
? onVideoCompletion(window.vidyardEmbed)
: (window.onVidyardAPI = (vidyardEmbed) => onVideoCompletion(vidyardEmbed));