Hi I’m brand new to coding with Velo and I’m trying to create a button that allows a user to download either a Document or a Video from my collection. For each row in the collection, either the Document or Video will be empty and the other will have a file. This code snippet lets me download Documents without issue but creates an error when downloading Videos:
Wix code SDK error: The link property that is passed to the link method cannot be set to the value “wix:video://[my file name]” as this is not a supported link type.
Here is my code:
// sets download link to either doc or video
const currentItem = $w("#dynamicDataset").getCurrentItem();
if (currentItem.video_link != null) {
$w("#button1").link = currentItem.video_link;
}
else if (currentItem.document_link != null) {
$w("#button1").link = currentItem.document_link;
}
});
Also if I don’t use code and simply click to connect button1 to video_link, I can download videos (but not documents).
Seems like a simple problem to fix, but I haven’t found a solution after searching for the past hour. Any help would be appreciated!
Back to your issue related to your screenshot of the ERROR-LOG…
Wix code SDK error: The link property that is passed to the link method cannot be set to the value "wix:video://[my file name]" as this is not a supported link type.
"wix:video://[my file name]"
If this was your VALUE for your BUTTON to be a LINK, then of course it was not right!
Instead it should be something like…
`wix:video://${my file name}`
And – “my file name” should be a string.
The error actually lists out the full name of the file. I just excluded the file name in my initial question and wrote [my file name] to shorten the question. The error reads:
Wix code SDK error: The link property that is passed to the link method cannot be set to the value “wix:video://v1/2bc498_50ffd6aeedf746bc810da7c7450c1ee0/Trimmed%20Test%20Video.mov#posterUri=2bc498_50ffd6aeedf746bc810da7c7450c1ee0f001.jpg&posterWidth=1068&posterHeight=604” as this is not a supported link type.
@jonah-birnberg
Ok, do a test for me!
let LINK = "wix:video://v1/2bc498_50ffd6aeedf746bc810da7c7450c1ee0/Trimmed Test Video.mov#posterUri=2bc498_50ffd6aeedf746bc810da7c7450c1ee0f001.jpg&posterWidth=1068&posterHeight=604"
wix:video://${LINK}
Try to setup this link manualy to your BUTTON!
Does it work?
@russian-dima Thanks for the responses! I tried a bunch of the things you mentioned, but unfortunately they still don’t work. What I tried:
- Manually changed the button link to
wix:video://${ **LINK** }
trying it both with LINK in decoded and encoded form. Same error as my original post.
- I re-named and re-uploaded my video file to get rid of spaces in the name. And I tried with decoded and encoded form. Same error.
Also I can still download document links with my code, using currentItem.document_link. It’s just currentItem.video_link that doesn’t work. And it’s only in code where it doesn’t work - if I click to connect the button with video_link, it works.
@jonah-birnberg Sorry, i would have to investigate your project, to be able to inspect your issue in detail, but this would become a service, i can’t inspect all running issues in this forum, even if i like to solve problems , you surely will understand this.
You have 3 options:
- waiting, until perhaps anybody else can help you out.
- trying to collect more information about your issue (to be able to solve it on your own).
- using a service
a)
b) you look for a developer/coder here in the forum…
@russian-dima Sounds good, I’m going to keep trying to solve the issue on my own. Thanks