提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.demo.module; |
H |
2 |
|
|
3 |
import java.awt.Panel; |
|
4 |
|
|
5 |
import com.iailab.netsdk.lib.NetSDKLib.LLong; |
|
6 |
import com.iailab.netsdk.lib.ToolKits; |
|
7 |
|
|
8 |
import com.sun.jna.Native; |
|
9 |
|
|
10 |
/** |
|
11 |
* 实时预览接口实现 |
|
12 |
* 主要有 :开始拉流、停止拉流功能 |
|
13 |
*/ |
|
14 |
public class RealPlayModule { |
|
15 |
/** |
|
16 |
* \if ENGLISH_LANG |
|
17 |
* Start RealPlay |
|
18 |
* \else |
|
19 |
* 开始预览 |
|
20 |
* \endif |
|
21 |
*/ |
|
22 |
public static LLong startRealPlay(int channel, int stream, Panel realPlayWindow) { |
|
23 |
LLong m_hPlayHandle = LoginModule.netsdk.CLIENT_RealPlayEx(LoginModule.m_hLoginHandle, channel, Native.getComponentPointer(realPlayWindow), stream); |
|
24 |
|
|
25 |
if(m_hPlayHandle.longValue() == 0) { |
|
26 |
System.err.println("开始实时预览失败,错误码" + ToolKits.getErrorCodePrint()); |
|
27 |
} else { |
|
28 |
System.out.println("Success to start realplay"); |
|
29 |
} |
|
30 |
|
|
31 |
return m_hPlayHandle; |
|
32 |
} |
|
33 |
|
|
34 |
/** |
|
35 |
* \if ENGLISH_LANG |
|
36 |
* Start RealPlay |
|
37 |
* \else |
|
38 |
* 停止预览 |
|
39 |
* \endif |
|
40 |
*/ |
|
41 |
public static void stopRealPlay(LLong m_hPlayHandle) { |
|
42 |
if(m_hPlayHandle.longValue() == 0) { |
|
43 |
return; |
|
44 |
} |
|
45 |
|
|
46 |
boolean bRet = LoginModule.netsdk.CLIENT_StopRealPlayEx(m_hPlayHandle); |
|
47 |
if(bRet) { |
|
48 |
m_hPlayHandle.setValue(0); |
|
49 |
} |
|
50 |
} |
|
51 |
} |