I appended following code to standard "Chapters" project (in main.js):
Diagnostics.listeners.add("file");
Diagnostics.trace.autoFlush = true;
addEventListener("chapter", ChapterChangeEvent, false);
function ChapterChangeEvent(evt)
{
Diagnostics.trace.writeLine("Old Chapter:" + evt.oldValue, "", 1);
Diagnostics.trace.writeLine("New Chapter:" + evt.newValue, "", 1);
Diagnostics.trace.writeLine("---", "", 1);
}
After I ran demo project and clicked only by "Chapter 2", "Chapter 3" buttons.
In result I see following log file:
Old Chapter:0
New Chapter:0
---
Old Chapter:0
New Chapter:1
---
Old Chapter:1
New Chapter:0
---
Old Chapter:0
New Chapter:1
---
Old Chapter:1
New Chapter:2
---
Old Chapter:2
New Chapter:1
---
Old Chapter:1
New Chapter:2
---
Why I received events marked as red I think that it gibberish.

Question about chapter change event
rajshekar
I added the title time to the output. I hit "Chapter 2" at ~ 3 seconds, and "Chapter 3" at ~ 8 seconds. Here is what I got:
00:00:00:00: Old Chapter:NaN
00:00:00:00: New Chapter:0
---
00:00:03:24: Old Chapter:0
00:00:03:24: New Chapter:1
---
00:00:04:59: Old Chapter:1
00:00:04:59: New Chapter:0
---
00:00:05:04: Old Chapter:0
00:00:05:04: New Chapter:1
---
00:00:08:14: Old Chapter:1
00:00:08:14: New Chapter:2
---
00:00:09:59: Old Chapter:2
00:00:09:59: New Chapter:1
---
00:00:10:01: Old Chapter:1
00:00:10:01: New Chapter:2
---
My guess is that because the sample just uses low-quality WMV file that wasn't specifically created for those chapter marks, the player gets the initial jump request (green) but then has to jump to approximately the right place (ie, back to the closest i-frame) which causes it to go slightly back in time to the previous chapter (red) and then it almost immediately transitions to the right chapter (blue)..
This is probably a WMV / HDiSim issue. Can you repro on a real player with real content that has the chapter marks correctly encoded
Pooja Katiyar
you started the title and chapter 1 began (0 to 0)
chapter 2 began (or you jumped to it) (0 to 1)
you jumped to chapter 1 (1 to 0)
chapter 2 began (or you jumped to it) (0 to 1)
chapter 3 began (or you jumped to it) (1 to 2)
you jumped to chapter 2 (2 to 1)
chapter 3 began (or you jumped to it) (1 to 2)
check the timing of chapters 1, 2, and 3 - they could be starting on their own before you even jump to them which would account for the additional events.
AlexBB
Unless the extra chapter-jump events are causing you a problem, I would just try to live with them or modify the code to be resilient to such changes -- any "work-arounds" you code may end up having worse consequences down the line.
If you really do need to ignore the extra chapter changes, I would not use a timer but rather I would do something like this when you get the event:
Here "close enough" is probably within half a second.
Wayne Sepega
Hello All,
Sorry, but I can't check it on hardware player. I tried to use HQ video (Robotica: http://www.microsoft.com/windows/windowsmedia/musicandvideo/hdvideo/contentshowcase.aspx), but that not solved my problem. I agree with Peter Torr, that problem can be related to WMV file structure. But I don't know how I can find true time markers for chapters. Can you help me with it
P.S.
I have one idea. I can create timer with 1-3 sec interval (all chapters are more 3 sec usually), and block (not using own function from change chapter event handler) it event for this and previous chapters on this period. As result I can get only correct events (marked as green). What do you think about it