Forum Discussion
RyanStanford1
6 years agoQrew Captain
Hey Adam, yes those will work to have the video/file/image showing in a field...
My usage isn't in an actual itself, but actually shows as a pop up when the button is clicked.
My usage isn't in an actual itself, but actually shows as a pop up when the button is clicked.
- AdamKeever16 years agoQrew CommanderGlad its working for you. I wonder if the pop up is a web browser setting? I use Chrome with default settings and it plays in the form or in the table.
- RyanStanford16 years agoQrew CaptainNope, the popup is custom HTML code I wrote myself. It's the user experience we were looking for.
- AdamKeever16 years agoQrew CommanderNice. Good job. Do you mind sharing the code for reference?
- RyanStanford16 years agoQrew CaptainI can give snippets to help point you in the right direction... Can't give all due to IP...
Basically, Rich Text field which makes a button with Launch as a class... gives the record ID as a dataset paramater
JS Code page with event handler for a.Launch...
API call to get the File URL:API_DoQuery&clist=a&query={'3'.EX.'<record ID>'}&fmt=structured
the fmt=structured gives the properties of the fields, not just the data... the file attachment fields will have a child element of "url" this is the link for the file attachment.var file = (Request.responseXML.documentElement.getElementsByTagName("url"))[0].innerHTML;
var extension = file.substring(file.lastIndexOf('.')+1, file.length);
I'm then able to add html code based on extension of the file...
Eample:if(extension === "mp4"){document.body.innerHTML += '<div id="light"><a class="boxclose" id="boxclose" onclick="lightbox_close();">x</a><video id="VideoLauncher" width="600" controls controlsList="nodownload"><source src="'+file+' " type="video/mp4"><!--Browser does not support <video> tag --></video></div><div id="fade" onClick="lightbox_close();"></div>'}
With the elements now created, add CSS to get them how you wish... I have these set to display:none as default...
Then function to actually show elements:function lightbox_open() { var lightBoxVideo = document.getElementById("VideoLauncher"); window.scrollTo(0, 0); document.getElementById('light').style.display = 'block'; document.getElementById('fade').style.display = 'block'; try{lightBoxVideo.play();}catch{}}
And have another function for lightbox_close() to handle getting out of the pop up view...