Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
portuguese
Composition Setup
import.css=/download/attachments/6062824/tecnologia.css

Pagetitle

...

...

Classe TMediaPlayer
Classe

...

TMediaPlayer

Cria um objeto para reprodução de vídeos e áudios.

Hierarquia

Construtores

Inclusão de trecho
Classe TMediaPlayer - Construtores
Classe TMediaPlayer - Construtores
nopaneltrue

Propriedades

Inclusão de trecho
Classe TMediaPlayer - Propriedades
Classe TMediaPlayer - Propriedades
nopaneltrue

Métodos

Inclusão de trecho
Classe TMediaPlayer - Métodos
Classe TMediaPlayer - Métodos
nopaneltrue

Observações

Este componente utiliza tecnologia ActiveX, através do Windows Media Player®, desta forma estando homologado apenas para os sistema operacionas da Microsoft®, dentre eles:

Windows XP
Windows Vista
Windows 7
Windows 8

O Windows Media

...

Player® pode depender de Codecs específicos para reprodução dos arquivos MP4, como teste basta executar este arquivo diretamente na ferramenta da

...

Microsoft®, caso funcione nesta, a reprodução ocorrera sem problemas no TMediaPlayer.

Importante:

...

Este componente está disponível em versões superiores à 120420A.

Indica o nome do arquivo de mídia(MP4 ou

MP3

), que caso preenchido iniciara automaticamente a reprodução .X

 

SetShowBar

SetShowBar

Habilita a exibição da barra de ferramentas do Windows Media Player®.

TMediaPlayer(): SetShowBar( <lShow> ) -->

 

Nota
icontrue
titleAtenção

SmartClient HTML
Os formatos de arquivos homologados para SmartClient HTML são: MP4, MOV, WMV

e MP3

TSrvObject -> TControl -> TMediaPlayer

 

New

Método construtor da classe.

TMediaPlayer(): New ( [ nRow], [ nCol], [ nWidth], [ nHeight], [ oWnd], [ cFile], [ nVolume], [ lShowBar] ) --> oObjeto

 

NomeTipoDescriçãoObrigatórioReferência
nRowNuméricoIndica a coordenada vertical em pixels ou caracteres.  
nColNuméricoIndica a coordenada horizontal em pixels ou caracteres.  
nWidthNuméricoIndica a largura em pixels do objeto.  
nHeightNuméricoIndica a altura em pixels do objeto.  
oWndObjetoIndica a janela ou controle visual onde o objeto será criado.X 
cFileCaractereIndica o nome do arquivo de mídia(MP4 ou MP3), que caso preenchido iniciara automaticamente a reprodução .  
nVolumeNuméricoIndica o volume de audio, de 0 a 100  
lShowBarBoleanoSe .T. indica que será exibida a barra de comandos do próprio Windows Media Palyer®  

 

oObjeto
  • Retorna o objeto criado.

oMedia := TMediaPlayer():New(1, 1, 200, 200, oDlg, "c:/dir/file.mp4", 70, .T.)

 

OpenFile

 

OpenFile

Abre

e

inicia a reprodução de um arquivo de mídia.

TMediaPlayer(): Openfile([cFile]) -->

oMedia:OpenFile("c:/fir/file.mp3")

 

NomeTipoDescriçãoObrigatórioReferência
cFileCaracter 
NomeTipoDescriçãoObrigatórioReferência
lShowBoleanoSe .T. indica que será exibida a barra de comandos do próprio Windows Media Palyer®X 

 

 
oMedia:SetShowBar(.T.)
SetVolume

 

SetVolume

Ajusta a altura do volume de áudio.

TMediaPlayer(): SetVolume([nVolume] ) -->

Exemplos

oMedia:SetVolume(70)

Nome

Tipo

Descrição

Obrigatório

Referência

nVolume

Numérico

Indica o volume de audio, de 0 a 100

X

 

 

 

Play

Inicia reprodução.

 

TMediaPlayer():Play() -->

Exemplos
oMedia:Play()

 

 

Stop

Para a reprodução.

 

TMediaPlayer():Stop() -->

Exemplos
oMedia:Stop()

 

Pause

Pause

Pausa a reprodução.

 

TMediaPlayer(): Pause() -->

Exemplos
oMedia:Pause()
SetMute

SetMute

Liga e desliga a opção silencio (mute).

TMediaPlayer(): SetMute( <lMute> ) -->

 

NomeTipoDescriçãoObrigatórioReferência
lMuteBoleanoSe .T. habilita a opção silencio (mute)X 

 

oMedia:SetMute( .T. )

 

Propriedades

Nome

Tipo

Descrição

Obrigatório

Referência

nPlayCount

Numérico

Define e retorna a quantidade de repetições para reprodução da mídia

 

 

 

Bloco de códigothemeEclipse
languagecpp
title
theme
Exemplo
Eclipse
linenumberstrue
collapsefalse
#INCLUDE "TOTVS.CH"
USER FUNCTION TMediaPlayer()
    local nLeft := 1
 
   local nTopBtn := 202
   
 local showBar := .F.
 
   local isMute := .F.
    
local nVolume := 70

    SetStyle(5)

    DEFINE MSDIALOG oDlg TITLE "TMediaPlayer" FROM 0,0 TO 424,510 PIXEL


        oMedia := TMediaPlayer():New(1,nLeft,255,200,oDlg,"c:/garbage/file.mp4",nVolume,showBar)


        TButton():New( nTopBtn, nLeft, "Open", oDlg,;

            {|| oMedia:openFile( FWInputBox("Escolha o arquivo", "c:/garbage/") ) },;
            28,010,,,.F.,.T.,.F.,,.F.,,,.F. )

        TButton():New( nTopBtn, nLeft+=28, "Play", oDlg,;

            {|| oMedia:play() },;
            28,010,,,.F.,.T.,.F.,,.F.,,,.F. )


        TButton():New( nTopBtn, nLeft+=28, "Pause", oDlg,;

            {|| oMedia:pause() },;
            28,010,,,.F.,.T.,.F.,,.F.,,,.F. )


        TButton():New( nTopBtn, nLeft+=28, "Stop", oDlg,;

            {|| oMedia:stop() },;
            28,010,,,.F.,.T.,.F.,,.F.,,,.F. )


        TButton():New( nTopBtn, nLeft+=28, "SetVolume", oDlg,;

            {|| oMedia:setVolume( Val( FWInputBox("Escolha a altura do volume [0-100]", cValToChar(oMedia:nVolume)) ) ) },;
            28,010,,,.F.,.T.,.F.,,.F.,,,.F. )

        TButton():New( nTopBtn, nLeft+=28, "GetVolume", oDlg,;

            {|| MsgAlert( oMedia:nVolume ) },;
            28,010,,,.F.,.T.,.F.,,.F.,,,.F. )

        TButton():New( nTopBtn, nLeft+=28, "ShowBar", oDlg,;

            {|| showBar:=!showBar, oMedia:setShowBar( showBar ) },;
            28,010,,,.F.,.T.,.F.,,.F.,,,.F. )

        TButton():New( nTopBtn, nLeft+=28, "nPlayCount", oDlg,;

            {|| oMedia:nPlayCount := ( Val( FWInputBox("Escolha o numero de repetições", cValToChar(oMedia:nPlayCount)) ) ) },;
            28,010,,,.F.,.T.,.F.,,.F.,,,.F. )


        TButton():New( nTopBtn, nLeft+=28, "SetMute", oDlg,;

            {|| isMute:=!isMute, oMedia:setMute( isMute ) },;
            28,010,,,.F.,.T.,.F.,,.F.,,,.F. )


    ACTIVATE MSDIALOG oDlg CENTERED

RETURN

 

 
Exemplo da classe TMediaPlayer
Image Removed

Resultado do Exemplo

Image Added

Abrangência

Microsiga Protheus 8.11 , Microsiga Protheus 11 , Protheus 10 , TOTVS Application Server 10 , ByYou Application Server

...