Data from the dynamic page in the lightbox

Hey guys,

I’m currently facing some issues when I’m trying to play video in the lightbox.
There is user content on a dynamic page like text, images, and video.
There is also a button which opens the lightbox, where I would like to play that video.
I have a code, but it does not work as I would wish, because it will load only the last uploaded video from the database, not the one I want to.

The dynamic page code:

import wixWindow from 'wix-window';

export function playvideo_onClick(event, $w) {
  wixWindow.openLightbox("Recenze", currentItem);
}

The lightbox code:

import wixWindow from 'wix-window';
$w.onReady(function () {
  const data = wixWindow.lightbox.getContext();
  $w('#video1').videoUrl = data.video;    
});

Does anyone of you have an idea, how to proceed?

Thanks,
J.

Issue solved.
For more info do not hesitate to visit:
https://www.wix.com/corvid/forum/community-discussion/dynamic-lightboxes-1
https://www.wix.com/corvid/reference/wix-window.html#openLightbox

The dynamic page code:

import wixData from "wix-data";
import wixWindow from 'wix-window';
var currentItem, ds; 

export function playvideo_onClick(event) {
  wixWindow.openLightbox("Recenze", {
 "pageSend1": $w('#videoPlayer1').src,
 "pageSend2": $w('#ID').text
  })
  .then( (data) => {
    $w('#videoPlayer1').src = data.lightboxSend1;
    $w('#ID').text = data.lightboxSend2;
  } );
}

The lightbox code:

import wixWindow from 'wix-window';

$w.onReady( function () {
 let received = wixWindow.lightbox.getContext();
  $w('#video1').videoUrl = received.pageSend1;
  $w('#ID').text = received.pageSend2;
} );

export function closeButton_click(event) {
  wixWindow.lightbox.close( {
 "lightBoxSend1": $w('#video1').videoUrl,
 "lightBoxSend2": $w('#ID').text
  } );
}

Br,
Jakub

Well done for finding your needed answer through the forum yourself.

Although, what happened to your previous post about this from Feb 2018?

Thanks. I deleted the previous post. This one is more clear to understand.

@jakub
No worries and thanks for the reply, clears it up perfectly.

@jakub Help!!! I need to do this same thing!! But i can’t seem to do it right! Have a button (button7) to open a video lightbox to play video from a URL in the dataset for the specific item/page. I’m stuck!!!

Having a similar issue, but I can’t even get my Lightbox to open using your code… thoughts?