C # Tutorial call APlayer

APlayer Introduction

Engine description:

APlayer media player engine is the Thunder from 2009 began to develop a universal audio and video media file playback kernel. 
Thunder look Thunder video player and as a player is to use APlayer core, the current Thunder players in PC market share ranked player first. 
Essentially APlayer Playback Engine is an ActiveX control that can be embedded in other local external program calls can also be directly embedded in Web pages, similar to (Adobe Flash Player). APlayer does not contain interface, but the other is dependent on APlayer APlayerUI ActiveX controls can provide a rich interface elements (playback control bar, Flash ads, etc.), APlayerUI also be included in the APlayerSDK in.

APlayer Features:

Closed DirectShow architecture, environmental interference from the decoding system 
-wide media file format support 
rich media file transfer protocol (HTTP / the FTP / MMS / rtsp / rtmp / HLS, etc.) 
powerful additional features (subtitles, audio track, transcode / turn format, quality enhancement, cut GIF ......) 
support multiple TS / FLV / MP4 sectioning files m3u8 seamless playback 
support for the latest H. 265 (HEVC) decoder (Powered by Beijing-Chun Technology Co., Ltd.) 
support panoramic video and virtual reality (VR) glasses Oculus DK2 playback.

APlayer Download

Proposal directly to APlayer official website to download the latest version

APlayer installation

To download the SDK and decoding library, first download after decompression SDK, SDK root directory as unpacked

Where bin directory is stored that some dll files and decoding library, the docs directory is the official help documentation, under the include directory is what I do not know, under the samples directory is the official demo, but looks like in C ++. The only thing we need to use in the bin directory and docs directory.

Next, open the bin directory, extract the downloaded codec library to the bin directory, overwriting the existing empty decoding library folder (codecs folder), covering the complete return SDK root directory, open cmd (how open is certainly not speak) jump to the SDK root directory, execute install.bat, after waiting for completion can turn off.

Next, open VS, create a Winform project, after the completion of the space the toolbox right> Add tab, and then the new tab named APlayer, and then on the new tab, right> select items, and then in the window that opens select the COM

Then there are a APlayer3 Control, in front of the check box is selected, and then click OK OK, if you are not there, then please repeat the second step, and with administrator privileges to run cmd.

Click OK APlayer tab there is a APlayer3 Control component, and onto the form can use it.

This step is not finished, because now you write a program, issued after the others, they also install APlayer for the job you want directly to others can use it, you need to open the Solution Explorer, select the reference in APlayer3Lib, and then open the properties panel, the inside of the separate properties and embedding property into True interoperability

APlayer this installation is complete (seemingly does not belong to the back part of the installation scope APlayer =. =)

APlayer use

Next is the use of APlayer, open docs file in the root directory folder APlayerSDK official manual inside (APlayer.chm)

What IDL definition of manual directory ah, what do not see, and C # does not matter, mainly to see APlayer methods, events and settings.

APlayer method

APlayer方法没什么好说的,也就是APlayer.方法名(参数),每个方法是干嘛的也有解释,写播放器的话我认为这些基础的东西应该都会了吧。

APlayer事件

APlayer虽然在VS属性面板中有事件,但是貌似并没有什么用,事件还是要自己写,所以就讲一下APlayer事件的用法吧,下面用OnMessage事件为栗来讲解。

先写个名为OnMessage(方法名可以自己定义,建议直接用事件名)的方法:

/// <summary>
/// OnMessage 事件发生在用户在 APlayer 视频区域引发鼠标操作或者当 APlayer 视频区域拥有焦点时引发键盘操作时。
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void OnMessage(object sender,AxAPlayer3Lib._IPlayerEvents_OnMessageEvent e)
{
    // 方法体
}

该方法有两个参数,第一个是object类型,第二个是APlayer内的一个类型,每个方法对应不同的类型,举个栗子:

OnMessag事件就是AxAPlayer3Lib._IPlayerEvents_OnMessageEvent 
OnStateChanged事件就是AxAPlayer3Lib._IPlayerEvents_OnStateChangedEvent 
OnDownloadCodec事件就是AxAPlayer3Lib._IPlayerEvents_OnDownloadCodecEvent

然后在窗口的Load事件里面,将定义的OnMessage方法绑定(委托?拜托?指定?指引?绑架?反正就是这个意思而已)

APlayer.OnMessage += new AxAPlayer3Lib._IPlayerEvents_OnMessageEventHandler(OnMessage);

绑定的方法就是:

APlayer.事件名 += new APlayer中事件对应的类(要绑定的方法名)

再举个栗子:

OnMessage 事件就是: 
APlayer.OnMessage += new AxAPlayer3Lib._IPlayerEvents_OnMessageEventHandler(OnMessage); 
OnStateChanged事件就是: 
APlayer.OnStateChanged += new AxAPlayer3Lib._IPlayerEvents_OnStateChangedEventHandler(OnStateChanged); 
OnDownloadCodec事件就是: 
APlayer.OnDownloadCodec += new AxAPlayer3Lib._IPlayerEvents_OnDownloadCodecEventHandler(OnDownloadCodec);

这样就可以绑定事件了,然后在自己写的方法中写事件触发时要执行的代码。

APlayer设置

APlayer设置的话主要是通过GetConfig和SetConfig方法来完成,GetConfig用于获取设置的值,SetConfig用于设置对应设置的值。

返回值:string GetConfig(int 设置编号)
返回值:int GetConfig(int 设置编号,string 设置值)
设置编号可以查看官方手册中的 “APlayer 设置” 章节

Demo下载

我找了两个Demo,可以下载看看,里面还有设置logo的方法 
Demo下载      APlayer




Guess you like

Origin www.cnblogs.com/zhangwc/p/12154650.html