//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "FrameStreamingAcesF.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "cxButtons"
#pragma link "cxGraphics"
#pragma link "cxLookAndFeelPainters"
#pragma link "cxLookAndFeels"
#pragma link "dxSkinBlack"
#pragma link "dxSkinMcSkin"
#pragma link "dxSkinsCore"
#pragma link "ImageBtn"
#pragma link "cxContainer"
#pragma link "cxControls"
#pragma link "cxEdit"
#pragma link "cxLabel"
#pragma link "AcesTechXPlayer2Lib_OCX"
#pragma link "IdBaseComponent"
#pragma link "IdComponent"
#pragma link "IdHTTP"
#pragma link "IdTCPClient"
#pragma link "IdTCPConnection"
#pragma link "cxTextEdit"
#pragma resource "*.dfm"
TFrameStreamingAces *FrameStreamingAces;
//---------------------------------------------------------------------------
__fastcall TFrameStreamingAces::TFrameStreamingAces(TComponent* Owner)
    : TFrame(Owner)
{
    FStrmPlay = false;

    FStrmHandle = 0;
}
//---------------------------------------------------------------------------
void __fastcall TFrameStreamingAces::OpenStream()
{
    FStrmUrl = EdStreamUrl->Text.Trim();

    AcesTechXPlayer21->URL = FStrmUrl;
    FStrmHandle = AcesTechXPlayer21->ConnectAsync();
    if (FStrmHandle > 0)
    {
    }
}
//---------------------------------------------------------------------------

void __fastcall TFrameStreamingAces::CloseStream()
{
    if (FStrmHandle > 0)
    {
        AcesTechXPlayer21->Close();
    }
}
//---------------------------------------------------------------------------

void __fastcall TFrameStreamingAces::BtnCameraConDisconnClick(TObject *Sender)
{
    TcxButton *btn = (TcxButton*)Sender;
    if (btn->Tag == 1) {
        // 연결
        btn->Tag = 0;
        btn->Caption = "영상 연결 해제";
        OpenStream();
    }
    else {
        // 연결 종료
        btn->Tag = 1;
        btn->Caption = "영상 연결";
        CloseStream();
    }
}
//---------------------------------------------------------------------------

