# Synchronize video playback with image playback

**URL:** <https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990>\
**Category:** Uncategorized\
**Created:** [April 18, 2006, 9:07am UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990 "2006-04-18T09:07:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![seraphangel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/seraphangel/32/2354_2.png) [@seraphangel](https://forum.kirupa.com/u/seraphangel)\
**Post date:** [April 18, 2006, 9:07am UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990/1 "2006-04-18T09:07:59Z")

</div>

Hey guys, I was wondering how can we synchronize a video playback with an image slideshow, what I would like to achieve is to have the image slideshow playback follow the sequence of a video playlist, so supposing I have item 1(a video) playing I would want the item 1(image) show up for the duration of the video and change to the following image when item 2(video) starts playing.  
Any ideas? Should I have one playlist for both videos and images or two seperate playlists, one for video and one for images?

I’m open to suggestions as long as i can get the image playback to follow the video playback.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![theflash](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/theflash/32/1221_2.png) [@theflash](https://forum.kirupa.com/u/theflash)\
**Post date:** [April 18, 2006, 9:15am UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990/2 "2006-04-18T09:15:24Z")

</div>

Are you loading contents externally ??

---

<div class="post-metadata">

**Author:** ![seraphangel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/seraphangel/32/2354_2.png) [@seraphangel](https://forum.kirupa.com/u/seraphangel)\
**Post date:** [April 19, 2006, 12:12am UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990/3 "2006-04-19T00:12:20Z")

</div>

yes, I am loading contents externally using an XML playlist. 🙂

---

<div class="post-metadata">

**Author:** ![claudio](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@claudio](https://forum.kirupa.com/u/claudio)\
**Post date:** [April 19, 2006, 3:13am UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990/4 "2006-04-19T03:13:50Z")

</div>

Since you have to synchronize one image per video, its easier since you dont need cuepoints. Can you explain me your scenario so i can help you better?

---

<div class="post-metadata">

**Author:** ![seraphangel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/seraphangel/32/2354_2.png) [@seraphangel](https://forum.kirupa.com/u/seraphangel)\
**Post date:** [April 19, 2006, 3:37am UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990/5 "2006-04-19T03:37:21Z")

</div>

alright, the scenario is like this:

I have four items running on playlist in my movie(let’s call them channels)  
Channel 1 = video  
Channel 2 = image 1  
Channel 3 = image 2  
Channel 4 = image 3

Now I am using one xml playlist to play through all my videos and another playlist to play through my images and text in channels 2-4.

What I want to achieve is:  
When Channel 1 plays item 1 in the video playlist, Channels 2-4 will play item 1 in the image playlist and cycle through the images available in each Channel(2-4) in a set amount of time. When item 1(video) finishes playing in Channel 1, Channels 2-4 will finish as well and follow Channel 1 in playing the second set of items.

Example playlist for my videos(Channel 1):

\<?xml version=“1.0” encoding=“iso-8859-1”?\>  
\<playlist\>

\<video messages=“X Men 3” flv=“flv/xmen3.flv” item=“0”/\>  
\<video messages=“Fantastic Four” flv=“flv/fantastic4.flv” item=“1”\>  
\<video messages=“Prisoner of Azkaban” flv=“flv/azkaban.flv” item=“2”/\>  
\<video messages=“Panasonic Viera” flv=“flv/viera.flv” item=“3”/\>  
\<video messages=“Avex Trax” flv=“flv/avex.flv” item=“4”/\>  
\<video messages=“Lumix” flv=“flv/lumix.flv” item=“5”/\>

\</playlist\>

Example playlist for the images(Channels 2-4):  
\*Note: not all the channels will have multiple items in it  
\<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?\>  
\<images\>  
\<items\>  
\<channel2\>  
\<images\>images/ch2/ss310.jpg\</images\>  
\<images\>images/ch2/ss305.jpg\</images\>  
\<images\>images/ch2/ss306.jpg\</images\>  
\</channel2\>  
\<channel3\>  
\<images\>images/ch3/ss308.jpg\</images\>  
\<images\>images/ch2/ss309.jpg\</images\>  
\</channel3\>  
\<channel4\>  
\<messages\>Testing Channel 4\</messages\>  
\</channel4\>

```
&lt;/items&gt;

&lt;items&gt;
    &lt;channel2&gt;
            &lt;images&gt;images/ch2/ss305.jpg&lt;/images&gt;
    &lt;/channel2&gt;
    &lt;channel3&gt;
            &lt;images&gt;images/ch3/ss309.jpg&lt;/images&gt;
            &lt;images&gt;images/ch2/ss307.jpg&lt;/images&gt;
    &lt;/channel3&gt;
       &lt;channel4&gt;
            &lt;messages&gt;Network Casting Test&lt;/messages&gt;
    &lt;/channel4&gt;

&lt;/items&gt;

&lt;items&gt;
    &lt;channel2&gt;
            &lt;images&gt;images/ch2/ss306.jpg&lt;/images&gt;
    &lt;/channel2&gt;
    &lt;channel3&gt;
            &lt;images&gt;images/ch3/ss307.jpg&lt;/images&gt;
    &lt;/channel3&gt;
       &lt;channel4&gt;
            &lt;messages&gt;Hello, testing testing&lt;/messages&gt;
    &lt;/channel4&gt;

&lt;/items&gt;

&lt;items&gt;
    &lt;channel2&gt;
            &lt;images&gt;images/ch2/ss306.jpg&lt;/images&gt;
    &lt;/channel2&gt;
    &lt;channel3&gt;
            &lt;images&gt;images/ch3/ss307.jpg&lt;/images&gt;
    &lt;/channel3&gt;
       &lt;channel4&gt;
            &lt;messages&gt;Hello, testing testing&lt;/messages&gt;
    &lt;/channel4&gt;

&lt;/items&gt;    

```

\</images\>

it sounds simple but yet complicated but i’m definitely having a headache with it at the moment, hope you can help me out with this bro, deadline’s coming in soon ☹

---

<div class="post-metadata">

**Author:** ![seraphangel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/seraphangel/32/2354_2.png) [@seraphangel](https://forum.kirupa.com/u/seraphangel)\
**Post date:** [April 19, 2006, 3:41am UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990/6 "2006-04-19T03:41:56Z")

</div>

my code for playing Channels 2-4 simultaeously:

delay = 15000;  
//-----------------------  
function loadXML(loaded) {

if (loaded) {

xmlNode = this.firstChild;  
image = [];  
image3 = [];  
messages = [];  
total = xmlNode.childNodes.length;  
subtotal = xmlNode.childNodes.childNodes.childNodes.length;

for (var q=0; q\<total; q++) {

image[q] = xmlNode.childNodes[q].childNodes[0].childNodes[0].firstChild.nodeValue;  
image3[q] = xmlNode.childNodes[q].childNodes[1].childNodes[0].firstChild.nodeValue;  
messages[q] = xmlNode.childNodes[q].childNodes[2].childNodes[0].firstChild.nodeValue;

}

firstImage();

} else {

content = “file not loaded!”;

}

}

xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“channel2.xml”);

p = 0;

function nextImage() {

if (p\<(total-1)) {

p++;

if (loaded == filesize) {

picture2.\_alpha = 0;  
picture2.loadMovie(image[p], 1);  
picture3.\_alpha = 0;  
picture3.loadMovie(image3[p], 1);  
desc\_txt2.text = messages[p];  
slideshow();

}

}

}

function firstImage() {

if (loaded == filesize) {

picture2.\_alpha = 0;  
picture2.loadMovie(image[0], 1);  
picture3.\_alpha = 0;  
picture3.loadMovie(image3[0], 1);  
desc\_txt2.text = messages[0];  
slideshow();

}

}

function slideshow() {

myInterval = setInterval(pause\_slideshow, delay);  
function pause\_slideshow() {

clearInterval(myInterval);  
if (p == (total-1)) {

p = 0;  
firstImage();

} else {

nextImage();

}

}

}

my code for playing through my video playlist

var xml:XML = new XML();  
xml.ignoreWhite = true;

xml.onLoad = function(i) {  
var nodes = this.firstChild.childNodes;  
for(var i=0; i\<nodes.length; i++) {  
list.addItem(nodes\*.attributes.desc, nodes\*.attributes.flv,  
nodes\*.attributes.item);

```
}

    vid.play(list.getItemAt(0).data)
    list.selectedIndex = 0;

```

}

xml.load(“playlist.xml”);

var lList:Object = new Object();  
lList.change = function() {  
vid.play(list.getItemAt(list.selectedIndex).data);  
count = list.selectedIndex;  
}

list.addEventListener(“change”, lList);

var vidList:Object = new Object();  
var count:Number = 0;

vidList.complete = function() {  
if(seq.selected) {  
if(count == list.length-1){  
count = 0;  
}  
else {  
count++;  
}  
}  
else {  
var temp = count;  
while(temp == count) {  
count = Math.floor(Math.random()\*list.length);  
}  
}

```
vid.play(list.getItemAt(count).data);
list.selectedIndex = count;

```

}

vid.addEventListener(“complete”, vidList);

I have the codes on the first keyframe of seperate time lines. Does that affect anything?

---

<div class="post-metadata">

**Author:** ![seraphangel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/seraphangel/32/2354_2.png) [@seraphangel](https://forum.kirupa.com/u/seraphangel)\
**Post date:** [April 19, 2006, 2:40pm UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990/7 "2006-04-19T14:40:13Z")

</div>

> [@claudio](#):
>
> Since you have to synchronize one image per video, its easier since you dont need cuepoints. Can you explain me your scenario so i can help you better?

ya I do not want to use cuepoints, cause I want to be able to easily add or change new content using the playlist.

---

<div class="post-metadata">

**Author:** ![seraphangel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/seraphangel/32/2354_2.png) [@seraphangel](https://forum.kirupa.com/u/seraphangel)\
**Post date:** [April 20, 2006, 1:05am UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990/8 "2006-04-20T01:05:42Z")

</div>

knock knock, anybody out there that can help me out with this?

---

<div class="post-metadata">

**Author:** ![seraphangel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/seraphangel/32/2354_2.png) [@seraphangel](https://forum.kirupa.com/u/seraphangel)\
**Post date:** [April 20, 2006, 4:07pm UTC](https://forum.kirupa.com/t/synchronize-video-playback-with-image-playback/185990/9 "2006-04-20T16:07:04Z")

</div>

any ideas claudio?  
really appreciate the help.
