Dynamic media - video in choice list from dynamic CSV

1. What is the issue? Please be detailed.
I have few videos that I would like to display in the choice list option. User can see the list and the video icon if the choice list if part of the default "choice list" of xlsform.
I am using external CSV for dynamic list, as mentioned in the link below I have mentioned the column name that contains the file name of the video (available in media folder). See the screenshots below.
I am not able to see the play video icon in the choice list next to the text.

2. What steps can we take to reproduce this issue?
I am following the feature/logic explained in link below,

"In your choices worksheet row, you may also include a .csv column name in the image column. If you do, the image filename to use will be pulled from the specified .csv column.
Note:
If you refer to image files in this way, you must always upload those image files as media file attachments when you upload your form to the server."

3. What have you tried to fix the issue?

4. Upload any forms or screenshots you can share publicly below.


Hi @Prashant_K

Only images are supported in this case. Neither videos or audios can be used like that.

@Grzesiek2010 Is there a reason why we can't support video/audio?

Dynamic selects from pre-loaded data is a functionality that was implemented a long time ago (10 years) and it was developed by Dobility, Inc. (as part of SurveyCTO) according to the copyright headers. As far as I remember we have never touched that feature and generally it exists totally outside of the rest of the form spec. We would need to ask @LN but my impression has always been that this is something we don't want to develop.

What is your primary reason for wanting to use an external list in this case? How many choices do you have?

We don't currently really support images this way either because Central does not have a way of attaching arbitrary media files to a form. You can see how folks like @ahblake overcome this limitation at Pull data with photos - #6 by ahblake

What we'd like to do longer term is have a concept of media attached to entities. That will make it possible to keep the media in sync with their corresponding entities rather than having a CSV and media that need to be kept in sync by some external process. We don't have a timeline for this yet, though. As @Grzesiek2010 states, we maintain search() for existing forms but don't document it or expect to build further on it.

Our use case is likely different, but we have an external list with up to 10-15K items. We don't have a need to display a video, but the ability to attach arbitrary image files to the form in Central would be quite helpful.

1 Like

I hear you. We designed the form attachment functionality the way that it is because we learned from Aggregate users that both forgetting to attach expected media and attaching superfluous media were problems (Aggregate just let you attach any files you wanted). With Central's more structured approach, those mistakes are impossible.

Generally, when folks want to attach CSVs that reference media, the CSVs really represent lists of entities that have some broader lifecycle in their project so we'd like to address the media need at the entities level. That would mean we could, for example, have media captured with one form automatically available in other forms representing other workflow steps.

I was asking @Prashant_K about reasons for wanting to use an external file to get at whether they are aiming for an entities-like workflow: are they generating the CSVs programmatically, updating them over time, etc.

Currently, Central parses the form definition, creates attachment slots based on that parse, and only accepts files that fit in those slots. I don't think it would be straightforward to have it accept arbitrary attachments and it's not something we would want in the core.

If you're attaching media programmatically, one (possibly terrible) stopgap idea would be to have a dummy list like @ahblake described and to use filenames that are <row number>.jpg. That way the form definition never has to change, even if the attachment does. Let's say you know you'll have at most 20,000 of them, you'd have 1.jpg, 2.jpg... 20000.jpg. To make things really explicit and to support row deletion, I would include a column in the CSV with that numbering. When you update row 3, you'd attach whatever corresponding image as 3.jpg and so on. That would allow you to reuse that same form and dummy list even as the "entities" change.

Hi @LN
Sorry to come back late.
Yes, we are creating the CSV dynamically through script and pushing the media separately (videos) to the phone.
Currently every time I need to create new form version along with uploading videos separating and update the choice list.