Announcement Announcement Module
Collapse
No announcement yet.
Problem with playing of AVI video stream from controller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with playing of AVI video stream from controller

    Hello, Everybody

    In my application I need to demonstrate some visual information. I keep video (.AVI) in database and have link on my JSP to show it. I use base Spring Controller. On request, It retrieves video from database and return it as output stream to JSP.

    InputStream is = dataManager.getVideoAsStream( "2" );
    if( is != null ) {
    try {
    response.setContentType( "video/x-msvideo" );
    FileCopyUtils.copy( is, response.getOutputStream() );
    }
    catch( IOException e ) {
    e.printStackTrace();
    }
    }

    It works fine... almost… I have some strange behavior for .AVI video. It is going well if I get “Save Target As…” and play my downloaded file after that. But if I click on my link and trying to watch the video without saving file on disk, it plays sound only. Windows Media Player starts and plays my file without picture. There is no problem with codec, as I told…, it is possible to play this file correctly after downloading, but impossible directly as stream. May be I need to set some additional information in the header or something else…? Anybody had same problem?

    Thank you.

  • #2
    if your using a SimpleFormController, try calling setCacheSeconds(-1); in your constructor, that might have something to do with it, not sure tho

    Comment


    • #3
      Thank you, tobysaville

      I will “play” with it. For this moment it looks like it is browser’s problem. I did several tests. Some AVI files works correctly (as stream), some - no. Possible it depends on the codec. May be browser can’t “catch” some codec during the streaming (for example I can’t play AVI files from my Logitech WEB cam as stream from my Controller). Sure, all those AVIs I can play as files.

      Comment

      Working...
      X