Welcome guest, is this your first visit? Create Account now to join.
Results 1 to 2 of 2

This is a discussion on NPAPI plugin with src attribute of Mixed-Replace content (multipart/x-mixed-replace) within the Plugins Development section, part of the Chrome Plugins category: Hello Experts, I have developed an NPAPI plugin which displays and manipulates images, the image to be displayed in the ...


  1. #1
    khalidomar is offline Junior Member
    Join Date
    Dec 2010
    Posts
    2

    Question NPAPI plugin with src attribute of Mixed-Replace content (multipart/x-mixed-replace)

    Hello Experts,

    I have developed an NPAPI plugin which displays and manipulates images, the image to be displayed in the plugin is specified via the "src" attribute of the embed tag.

    The browser loads the image specified by the "src" attribute and calls my plugin to deliver the image. The calls I receive are in the following order:
    • NPP_NewStream(): with NPMIMEType = "image/jpeg"
    • NPP_WriteReady() & NPP_Write(): multiple times until the image is fully read
    • NPP_DestroyStream(): When the image is fully delivered (or an error occurs)


    I recently decided to add support for motion jpeg video (MJPEG), which is basically a series of jpeg images in the same HTTP stream separated by a special separator, the response type of the "src" attribute in this case would have an initial MIME type of "multipart/x-mixed-replace" and then "image/jpeg" for each jpeg frame. (BTW, chrome and firefox can handle motion jpeg video when the url is typed directly in the address bar)

    So far, I haven't been able to get the browser to deliver the motion jpeg stream to the plugin; the browser does initiate the communication with the motion jpeg server and retrieves the HTTP headers and the headers of the first frame, but fails to deliver the first image and calls NPP_DestroyStream() with reason=NPRES_NETWORK_ERR

    Here is a more detailed description of what is going on:
    • Browser calls NPP_NewStream() with NPMIMEType="multipart/x-mixed-replace" and *stype = NP_NORMAL
    • Browser calls NPP_NewStream() again with NPMIMEType="image/jpeg" and *stype = NP_NORMAL (the stream pointer I receive here is the same as the one received in the previous call to NPP_NewStream)
    • Browser calls NPP_WriteReady(): my plugin returns 100 * 1024
    • Browser calls NPP_Write() and delivers 711 bytes
    • Browser calls NPP_DestroyStream() with reason = NPRES_NETWORK_ERR

    I never managed to get the browser to read any frames for me. I'm not sure if Mixed-Replace mime type is supposed to be used with NPAPI plugins but I'm thinking why not?

    I'm using Chromium 11.0.696.71 and have seen this behavior on Windows 7 64-bit and 32-bit

    Can some one enlighten me what could be the problem?

    Thanks very much...
    Khalid.
    Last edited by khalidomar; 06-15-2011 at 01:07 PM.

  2. #2
    khalidomar is offline Junior Member
    Join Date
    Dec 2010
    Posts
    2

    Default

    FYI ... I could not resolve the issue, so the solution was to cancel Chromium stream (return NPERR_GENERIC_ERROR from NPP_NewStream()) and download the stream manually using libcurl

Similar Threads

  1. Install NPAPI plugin in Chrome
    By Arthur in forum Plugins Development
    Replies: 1
    Last Post: 12-14-2011, 12:24 AM
  2. How Generate Working multipart/mixed MIME Type?
    By sshark in forum Chrome Tech
    Replies: 0
    Last Post: 11-01-2010, 10:48 AM
  3. Npapi plugin not loading
    By dirtdog in forum Plugins Troubleshooting
    Replies: 0
    Last Post: 10-22-2010, 07:38 AM
  4. Adapting NPAPI plugin for chrome
    By Hansen in forum Plugins Development
    Replies: 16
    Last Post: 09-22-2010, 11:21 PM
  5. NPAPI plugin in Chrome
    By markh in forum Plugins Development
    Replies: 8
    Last Post: 12-01-2009, 11:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •