XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Play a video in xna game

Last post 11/19/2008 7:49 AM by sandeep kurup. 2 replies.
  • 11/18/2008 11:02 AM

    Play a video in xna game

    Hi,

         I am new to xna, I want to play a video file in the starting of the game....The movie size is 6.33 MB....  i added the reference of Scurvy.Media and Scurvy.Media.Pipeline..... I wrote the code in function loadcontent() as

    ContentManager content = new ContentManager(Services);
     
    Video vid = content.Load<Video>(

    "mesh/start"); //start.avi is my file name
     
    vid.Loop = false; 
     
    vid.Play();

     

    in update method i given as

    vid.Update();

     

    But i am getting a very lengthy error like

    Error 1 Building content threw OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
       at System.IO.MemoryStream.set_Capacity(Int32 value)
       at System.IO.MemoryStream.EnsureCapacity(Int32 value)
       at System.IO.MemoryStream.Write(Byte[ buffer, Int32 offset, Int32 count)
       at System.IO.BinaryWriter.Write(Byte[ buffer)
       at Scurvy.Media.Pipeline.Video.PlatformSurface.x86Surface.WriteToXnb(ContentWriter output, Byte[ pix) in C:\Dev\codeplex\ScurvyMedia\Scurvy.Media\Scurvy.Media.Pipeline\Video\PlatformSurface.cs:line 57
       at Scurvy.Media.Pipeline.Video.VidContentWriter`1.Write(ContentWriter output, T value) in C:\Dev\codeplex\ScurvyMedia\Scurvy.Media\Scurvy.Media.Pipeline\Video\VidContentWriter.cs:line 44
       at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentTypeWriter`1.Write(ContentWriter output, Object value)
       at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentWriter.InvokeWriter[T](T value, ContentTypeWriter writer)
       at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentWriter.WriteObject[T](T value)
       at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentCompiler.Compile(Stream output, Object value, TargetPlatform targetPlatform, String rootDirectory, String referenceRelocationPath)
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.SerializeOutputAsset(BuildItem item, Object assetData, String outputFilename)
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.SerializeAsset(BuildItem item, Object assetData)
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
       at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[ sourceAssets, String[& outputContent, String[& rebuiltContent, String[& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[& warnings) C:\Projects\sample\Content\mesh\start.avi sample

     

    If it is the problem with the file size please tell me what should be the maximum size of the file....... And what are the audio and video file formats which is supported by XNA....

                                                                 Please help me to get out of this error
                                                                                     Thanks
                                                                                                             sandeep  

  • 11/18/2008 11:11 AM In reply to

    Re: Play a video in xna game

    My understanding is that scurvy turns the video into individual fames, which then get run through the content pipeline as images (so it uses lots of memory and produces a big file). This may be causing your out of memory problem.
    XNA doesn't have any native support for videos, however there are other options.
    I did a rough and quick port of a very simple MPEG2 decoder a while ago (here), but it's xbox performance is pants, and there are potential licensing issues with XBLCG. There are apparently other ways, but others will have to help you out there (did blade3d support video?). I can't remember. There are also a number of XNA directShow filter based projects you can try, but these are PC only.

    Xen: Graphics API for XNA
    www.codeplex.com/xen
  • 11/19/2008 7:49 AM In reply to

    Re: Play a video in xna game

    Answer
    Reply Quote
    Hi,



                         Thank You for the help. I got  help from the following links... Please find the websites....
                      

                    

                           http://www.codeplex.com/XNADSPlayer/Release/ProjectReleases.aspx?ReleaseId=11066

                           http://www.codeplex.com/XNADSPlayer

                           http://www.codeproject.com/KB/game/VidTextureClassWebcamApp.aspx?                                                                                                              fid=441427&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2629225


                                                                         Thanks and regards
                                                                                        sandeep

Page 1 of 1 (3 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG