SkeyePlayer plug-in instructions

Since everyone is not very familiar with the use of the SkeyePlayer plug-in, hereby write a plug-in usage document for your reference; there are two types of SkeyePlayer plug-ins, one is based on IE ActiveX control, and the other is based on FireFox (also supports multi-browsing device) npAPI plug-in; both plug-ins contain source code, because the FireBreath framework generates a lot of code, the npAPI plug-in only contains key codes, and a document explaining how FireBreath generates the SkeyePlayer npAPI plug-in will be provided later. Let’s start to explain how to use the two plug-ins .

  1. ActiveX OCX control

    It is very simple to generate ActiveX controls using the MFC ActiveX framework, so I won’t go into details here, interested students can Download SkeyePlayer source code ; Note that IE11 no longer supports AttachEvent to trigger browser page events, so students who need to export playback events need to do a good job of IE11 compatibility when writing front-end pages;

  2. npAPI plugin
    The npAPI plugin is provided by FireBreath framework Generate, the framework provides very detailed steps to generate the player plug-in framework we want, after the framework is generated, the SkeyePlayer source code SkeyePlayerPlugin The code in the directory can replace the generated code.
  1. Plug-in export interface description

    [1]    LONG Start(LPCTSTR sURL, LPCTSTR sRenderFormat, LPCTSTR sUserName, LPCTSTR sPassword, LPCTSTR sHardDecord);
    

The Start function encapsulates the SkeyePlayer_OpenStream function, and its function is to open an RTSP stream;

Parameter Description:
[sURL]: The address of the open stream, starting with rtsp://;
[sRenderFormat]: Play the rendering format, enumerate the corresponding format:
D3D supports the following formats:

YV12: 0
YUY2: 1
UYVY: 2
A8R8G8B8: 3
X8R8G8B8: 4
RGB565: 5
RGB555: 6

GDI supports formats:

RGB24:   7

Note: All parameters of the OCX interface function are of string type, mainly for the convenience of page js calls, as are all the interface parameters below;

[2]    void Config(LPCTSTR sFrameCache, LPCTSTR sPlaySound, LPCTSTR sShowToScale, LPCTSTR sShowStatisticInfo);

The Config function configures some parameters of the player, such as cache, whether to play audio, whether to display in proportion, whether to display bit rate information;
Parameter Description:
[sFrameCache]: The number of cached frames, 1-n, the smaller the value, the smaller the delay, of course, the playback screen may be slower when the network bandwidth is not ideal, otherwise, the greater the delay, the corresponding playback will be relatively smooth;
[sPlaySound]: Whether to play audio, 1=play, 0=not play
[sShowToScale]: whether to display in scale, 1=yes, 0=no, valid for soft decoding
[sShowStatisticInfo]: Whether to display the bit rate information, 1=yes 0=no, valid for soft decoding

[3]    void SetOSD(LPCTSTR show, LPCTSTR alpha, LPCTSTR red, LPCTSTR green, LPCTSTR blue, LPCTSTR left, LPCTSTR top, LPCTSTR right, LPCTSTR bottom, LPCTSTR strOSD);

SetOSD is a new interface for setting the OSD display when video is displayed;
Parameter Description:
[show]: whether to display OSD, 1=display 0=not display
[alpha]: OSD display overlay transparency, 0-255, 0 is completely transparent. 255 fully opaque
[red]: The R component in the RGB component of the OSD subtitle color,
[green]: the G component in the RGB component of the OSD subtitle color,
[blue]: The B component in the RGB component of the OSD subtitle color,
[left]: The x-axis coordinate of the upper left corner of the OSD based on the video display position coordinates
[top]: The y-axis coordinate of the upper left corner of the OSD based on the video display position coordinates
[right]: The x-axis coordinate of the lower right corner of the OSD based on the video display position coordinates
[bottom]: The y-axis coordinate of the lower right corner of the OSD based on the video display position coordinates
[strOSD]: OSD subtitle

[4] void Close(void);
Close closes the stream opened by Start;

Note that the current ActiveX control defines a control to initialize a unique SkeyePlayer player instance, and a Start corresponds to a Close function; the Start function can only be called once, and the next call must be Cose first, and then Start;

  1. WEB web page call
    We have already understood the export interface of the plug-in, so we can easily write JS to realize the playback on the web page. Of course, before this, we need to register the plug-in. There are reg.bat and np_reg.bat batches in the SkeyePlayer directory The processing file registers OCX and npAPI respectively, and it can be used after the registration is successful.

In the bin directory of SkeyePlayer, we have provided two Demo html pages for you to test and use. The JS code is very simple, just call it directly:

        function config(){
        var obj = document.getElementById("SkeyePlayerOcx");

        var cache = document.getElementById("cache").value;
        var playsound = document.getElementById("playsound").value;
        var showtoscale= document.getElementById("showtoscale").value;
        var showsatic = document.getElementById("showsatic").value;

        obj.Config(cache, playsound, showtoscale, showsatic);
                
        //alert(cache+";"+playsound+";"+showtoscale+";"+showsatic);

    }

    function startplay(){
        var obj = document.getElementById("SkeyePlayerOcx");
        var url = document.getElementById("url").value;
        var rendertype = document.getElementById("rendertype").value;
        var name= document.getElementById("name").value;
        var password = document.getElementById("password").value;
        var hardDecode = document.getElementById("hardwareDecode").value;
        

        obj.Start(url, rendertype, name, password,hardDecode);
        config();

        //alert(url+";"+rendertype+";"+name+";"+password);

    }

        function stopplay(){
        //alert("Close()!!!!!");
        var obj = document.getElementById("SkeyePlayerOcx");

        obj.Close();
    }

Tags: C++

Posted by beamerrox on Thu, 02 Mar 2023 09:23:01 +0530