Will Merydith

Is anyone aware of a way to take screen captures of the video and save those to the player storage for later viewing



Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Andy Pennell MSFT

Real code I stole from my boss, the playlist has a scheduled event when the capture is required:

application.addEventListener( "scheduled_event", OnScheduledEvent, false );

function VideoMainCaptureCallback(i,uri)
{
Player.playlist.play();
}

function PlayerVideoMainCapture(filename)
{
try
{
Player.video.main.capture(filename,VideoMainCaptureCallback);
}
catch (ex)
{
DebugOutput("PlayerVideoMainCapture(" + filename + ") Exception: " + ex.message);
}
}


function OnScheduledEvent(evt)
{
if (evt.id == 'Five')
{
Player.playlist.pause();
PlayerVideoMainCapture("
file:///filecache/test.cvi");
}
}







Re: HD DVD Interactivity Authoring Taking Screen Snapshots

sammaz

Ohhh man...now i can bokmark videos! I just got screenshot bookmarking working...just swap the code...too easy!

~thanx!





Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Jacco Mintjes

How do you display it in markup Do you have write it first to persistent storage

I've used this along with your code but no images was shown. (using HDi simulator):

in script:

document.screenshot.style.backgroundImage=url("file:///filecache/image.cvi");

in markup:

<div id="screenshot" style:position="absolute" style:x="0px" style:y="0px" width="1920px" height="1080px" style:display="auto" />





Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Xavier Arnau

i'm interested on this, can you work with PS with the Simulator




Re: HD DVD Interactivity Authoring Taking Screen Snapshots

DrumAllDay

Yes, you can save to p-stor on the simulator. However, images referenced in the markup must first be loaded into the filecache.




Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Jacco Mintjes

Just got it to work! Pretty cool feature. How to do it is a bit unusual, you first have to capture a "screenshot" to the filecache then copy the .cvi file from the filecache to the p. storage then copy it from the p.storage back into the filecache and then use some line to display it on screen.

Using SACA's emulator for testing.

BTW, if you want to view the cvi file: rename it to .raw open it in photoshop, enter for width and size 1920x1080 (or an other size if you have scaled it). However the picture is displayed in gray, maybe someone knows of a way to display .cvi images correctly





Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Xavier Arnau

and how you got to copy from the filecache to p. storage i'm so noob... :P




Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Jacco Mintjes

Using something like: application.FileIO.copy("file:///filecache/myimage.cvi","file:///required/myimage.cvi",true,function(){ });

But you better use a real function instead of just function(){}





Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Xavier Arnau

application.addEventListener( "scheduled_event", OnScheduledEvent, false );

function VideoMainCaptureCallback(i,uri)

{

application.FileIO.copy("file:///filecache/myimage.cvi","file:///required/myimage.cvi",true,aplicationFileIOCallback);

}

function aplicationFileIOCallback()

{

Player.playlist.play();

}

function PlayerVideoMainCapture(filename)

{

try

{

Player.video.main.capture(filename,VideoMainCaptureCallback);

}

catch (ex)

{

DebugOutput("PlayerVideoMainCapture(" + filename + ") Exception: " + ex.message);

}

}

 

function OnScheduledEvent(evt)

{

if (evt.id == 'Five')

{

Player.playlist.pause();

PlayerVideoMainCapture("file:///filecache/myimage.cvi");

}

}

The event is called with a button etc, well, this don't work, any tip And where should be the myimage.cvi stored I'm usind the MS Sim






Re: HD DVD Interactivity Authoring Taking Screen Snapshots

DrumAllDay

Jacco - Once you've taken the screen shot, its in the filecache and ready to use - you don't need to copy it to the p-stor and then copy it back to use it.  Putting the screenshot in p-stor is for when you want to access it later.  You only need to copy from p-stor back to the filecache after your app restarts (ie,  you've ejected the disc) and the screenshot is removed from the filecache (or if the screenshot is removed from your filecache during your app due to garbage collection).

Xavier - FileIO is its own object, it is not a member of application (use FileIO.copy).  Once you've finished your screen shot, you can set the background image of a div to uri('file:///filecache/myimage.cvi').  Your code is not triggered by button press, its triggered by a scheduled event from the playlist.  And the place you should store this is in your content directory ("file:///required" + PersistentStorageManager.contentId)






Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Xavier Arnau

i can't follow you at all, you say that in this code the event comes from the playlist... what i need to write in the playlist to do that

On the other side... i don't understand the part of ps directory, i have to create it manually Or it already exists How can i open it to saw if there's anything in...

I have C:\Archivos de programa\HD DVD Interactivity Jumpstart\Samples\Events\ADV_OBJ and

C:\Archivos de programa\HD DVD Interactivity Jumpstart\Samples\Events\HVDVD_TS so where is the ps directory






Re: HD DVD Interactivity Authoring Taking Screen Snapshots

DrumAllDay

The p-stor directory is automatically created when you write to the content directory. When using the simulator, I believe these directories will be created in your C:\Archivos de programa\HD DVD Interactivity Jumpstart\HD_DVD folder (if not, do a search for the HD_DVD folder on your hard drive).

Xavier - sounds like you are new enough to HDi that you would benefit from playing around with the sample applications from Microsoft more:

http://www.microsoft.com/downloads/details.aspx FamilyId=E19C869B-EF37-4E5E-91ED-32D059E3775B&displaylang=en

You will find examples of how to listen for key press events and the virtual key codes that represent the remote control keys.

Also, take a look at Peter Torr's blog (http://blogs.msdn.com/ptorr/) he has a lot of great code examples that will help you. Start with his "Hello World" sample (http://blogs.msdn.com/ptorr/archive/2006/03/29/564548.aspx) and work forward.

Good Luck.






Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Xavier Arnau

well actualy i have read Peter's blog and i have played with the samples... it's only that there are concepts that i don't understand




Re: HD DVD Interactivity Authoring Taking Screen Snapshots

Rajat Tripathi

 Xavier Arnau wrote:

i can't follow you at all, you say that in this code the event comes from the playlist... what i need to write in the playlist to do that

On the other side... i don't understand the part of ps directory, i have to create it manually Or it already exists How can i open it to saw if there's anything in...

I have C:\Archivos de programa\HD DVD Interactivity Jumpstart\Samples\Events\ADV_OBJ and

C:\Archivos de programa\HD DVD Interactivity Jumpstart\Samples\Events\HVDVD_TS so where is the ps directory

 

For firing events from the playlist use

<ScheduledControlList>

   <Event id="fireEvent" titleTime="00:00:05:00"

</ScheduledControlList>

This will call your function in the script corresponding to that event after 5 seconds in that title.

Persistent storage is created automatically. Look into C:\HDDVD\HD_DVD folder and you will find it.