não

as duas últimas respostas antes da sua mostram a última mudança que fiz, mas
não rolou.

tenta entender

2009/7/8 Erko Bridee de Almeida Cabrera <erko.bri...@gmail.com>

> depois desse ultimo email
> não entendi...
>
> funcionou?
>
> =]
>
>
> 2009/7/8 Vinão <vinu...@gmail.com>
>
>> Esse é o conectar:
>>
>>
>> private function init():void
>>             {
>>                 if(bConectar.label == "Conectado")
>>                 {
>>                     bConectar.label = "Conectar ao servidor";
>>                     statusImage.source = "off.png";
>>                 } else {
>>                     if(nc != null)
>>                     nc = null;
>>                 nc = new NetConnection();
>>                 nc.addEventListener( NetStatusEvent.NET_STATUS, netStatus
>> );
>>                 nc.connect("rtmp://empresa.com.br/oflaDemo/test");
>>                 // Este aplicxativo contém os métodos chamados pelo
>> servidor
>>                 nc.client = this;
>>                 usuario.editable = true;
>>                 }
>>             }
>>
>> e o transmitir:
>>
>> private function controlador():void
>>             {
>>                 if(controller.source == "play.png"){
>>                      controller.source = "stop.png";
>>                     nsPub = new NetStream (nc);
>>                     var camera:Camera = Camera.getCamera();
>>                     camera.setMode(320, 240, 15, false);
>>                       camera.setQuality(0, 80);
>>                       camera.setKeyFrameInterval(15);
>>                     nsPub.attachCamera(camera);
>>                     var microphone:Microphone =
>> Microphone.getMicrophone();
>>                     nsPub.attachAudio(microphone);
>>                     // nome que será publicado
>>                     nsPub.publish("hostStream", "live");
>>                 } else {
>>                     controller.source = "play.png";
>>                     nsPub.close()
>>                     nsPub = null
>>                 }
>>             }
>>
>>
>>
>> 2009/7/8 Vinão <vinu...@gmail.com>
>>
>>> Erko,
>>>
>>>
>>> Estou utilizando o projeto oflaDemo agora e alterei o meu onClick e agora
>>> está dessa forma:
>>>
>>> private function onClick():void {
>>>             // Record the stream by triggering a server event.
>>>             if (record.label == "Record") {
>>>                 Alert.show("Application.appConnect");
>>>                 // Tell the remote server to start recording.
>>>                 nc.call("Application.appConnect", null);
>>>                 // Re-label the button.
>>>                 record.label = "Stop";
>>>             // Stop recording the stream.
>>>             } else if (record.label == "Stop") {
>>>                 // Tell the remote server to stop recording.
>>>                  nc.call("Application.appDisconnect", null);
>>>                 // Re-label the button.
>>>                 record.label = "Record";
>>>             }
>>>
>>> O oflaDemo contém essas classes:
>>>
>>> Application:
>>> package org.red5.server.webapp.oflaDemo;
>>>
>>> import org.red5.server.adapter.ApplicationAdapter;
>>> import org.red5.server.api.IBandwidthConfigure;
>>> import org.red5.server.api.IConnection;
>>> import org.red5.server.api.IScope;
>>> import org.red5.server.api.stream.IServerStream;
>>> import org.red5.server.api.stream.IStreamCapableConnection;
>>> import org.red5.server.api.stream.support.SimpleConnectionBWConfig;
>>>
>>> public class Application extends ApplicationAdapter {
>>>     private IScope appScope;
>>>
>>>     private IServerStream serverStream;
>>>
>>>     /** {...@inheritdoc} */
>>>     @Override
>>>     public boolean appStart(IScope app) {
>>>         appScope = app;
>>>         return true;
>>>     }
>>>
>>>     /** {...@inheritdoc} */
>>>     @Override
>>>     public boolean appConnect(IConnection conn, Object[] params) {
>>>         // Trigger calling of "onBWDone", required for some FLV players
>>>         measureBandwidth(conn);
>>>         if (conn instanceof IStreamCapableConnection) {
>>>             IStreamCapableConnection streamConn =
>>> (IStreamCapableConnection) conn;
>>>             SimpleConnectionBWConfig bwConfig = new
>>> SimpleConnectionBWConfig();
>>>
>>> bwConfig.getChannelBandwidth()[IBandwidthConfigure.OVERALL_CHANNEL] =
>>>                 1024 * 1024;
>>>
>>> bwConfig.getChannelInitialBurst()[IBandwidthConfigure.OVERALL_CHANNEL] =
>>>                 128 * 1024;
>>>             streamConn.setBandwidthConfigure(bwConfig);
>>>         }
>>>
>>> //        if (appScope == conn.getScope()) {
>>> //            serverStream = StreamUtils.createServerStream(appScope,
>>> "live0");
>>> //            SimplePlayItem item = new SimplePlayItem();
>>> //            item.setStart(0);
>>> //            item.setLength(10000);
>>> //            item.setName("on2_flash8_w_audio");
>>> //            serverStream.addItem(item);
>>> //            item = new SimplePlayItem();
>>> //            item.setStart(20000);
>>> //            item.setLength(10000);
>>> //            item.setName("on2_flash8_w_audio");
>>> //            serverStream.addItem(item);
>>> //            serverStream.start();
>>> //            try {
>>> //                serverStream.saveAs("aaa", false);
>>> //                serverStream.saveAs("bbb", false);
>>> //            } catch (Exception e) {}
>>> //        }
>>>
>>>         return super.appConnect(conn, params);
>>>     }
>>>
>>>     /** {...@inheritdoc} */
>>>     @Override
>>>     public void appDisconnect(IConnection conn) {
>>>         if (appScope == conn.getScope() && serverStream != null) {
>>>             serverStream.close();
>>>         }
>>>         super.appDisconnect(conn);
>>>     }
>>> }
>>>
>>> DemoService:
>>> package org.red5.server.webapp.oflaDemo;
>>>
>>> import java.io.File;
>>> import java.io.IOException;
>>> import java.text.SimpleDateFormat;
>>> import java.util.Date;
>>> import java.util.HashMap;
>>> import java.util.Locale;
>>> import java.util.Map;
>>>
>>> import org.slf4j.Logger;
>>> import org.slf4j.LoggerFactory;
>>>
>>> import org.red5.server.api.IScope;
>>> import org.red5.server.api.Red5;
>>> import org.springframework.core.io.Resource;
>>>
>>> public class DemoService {
>>>
>>>     protected static Logger log =
>>> LoggerFactory.getLogger(DemoService.class);
>>>
>>>     private String formatDate(Date date) {
>>>         SimpleDateFormat formatter;
>>>         String pattern = "dd/MM/yy H:mm:ss";
>>>         Locale locale = new Locale("en", "US");
>>>         formatter = new SimpleDateFormat(pattern, locale);
>>>         return formatter.format(date);
>>>     }
>>>
>>>     /**
>>>      * Getter for property 'listOfAvailableFLVs'.
>>>      *
>>>      * @return Value for property 'listOfAvailableFLVs'.
>>>      */
>>>     public Map getListOfAvailableFLVs() {
>>>         IScope scope = Red5.getConnectionLocal().getScope();
>>>         Map<String, Map> filesMap = new HashMap<String, Map>();
>>>         try {
>>>             log.debug("getting the FLV files");
>>>             Resource[] flvs = scope.getResources("streams/*.flv");
>>>             addToMap(filesMap, flvs);
>>>
>>>             Resource[] mp3s = scope.getResources("streams/*.mp3");
>>>             addToMap(filesMap, mp3s);
>>>
>>>
>>>         } catch (IOException e) {
>>>             log.error("{}", e);
>>>         }
>>>         return filesMap;
>>>     }
>>>
>>>     private void addToMap(Map<String, Map> filesMap, Resource[] files)
>>>             throws IOException {
>>>         if (files != null) {
>>>             for (Resource flv : files) {
>>>                 File file = flv.getFile();
>>>                 Date lastModifiedDate = new Date(file.lastModified());
>>>                 String lastModified = formatDate(lastModifiedDate);
>>>                 String flvName = flv.getFile().getName();
>>>                 String flvBytes = Long.toString(file.length());
>>>                 if (log.isDebugEnabled()) {
>>>                     log.debug("flvName: {}", flvName);
>>>                     log.debug("lastModified date: {}", lastModified);
>>>                     log.debug("flvBytes: {}", flvBytes);
>>>                     log.debug("-------");
>>>                 }
>>>                 Map<String, Object> fileInfo = new HashMap<String,
>>> Object>();
>>>                 fileInfo.put("name", flvName);
>>>                 fileInfo.put("lastModified", lastModified);
>>>                 fileInfo.put("size", flvBytes);
>>>                 filesMap.put(flvName, fileInfo);
>>>             }
>>>         }
>>>     }
>>>
>>> }
>>>
>>> DemoServiceImpl:
>>> package org.red5.server.webapp.oflaDemo;
>>>
>>> import java.util.HashMap;
>>> import java.util.Map;
>>>
>>> public class DemoServiceImpl implements IDemoService {
>>>     /**
>>>      * Getter for property 'listOfAvailableFLVs'.
>>>      *
>>>      * @return Value for property 'listOfAvailableFLVs'.
>>>      */
>>>     public Map getListOfAvailableFLVs() {
>>>         System.out.println("getListOfAvailableFLVs empty");
>>>         return new HashMap(1);
>>>     }
>>>
>>>     public Map getListOfAvailableFLVs(String string) {
>>>         System.out.println("getListOfAvailableFLVs, Got a string: " +
>>> string);
>>>         return getListOfAvailableFLVs();
>>>     }
>>>
>>> }
>>>
>>>
>>> IDemoService:
>>> package org.red5.server.webapp.oflaDemo;
>>>
>>> import java.util.Map;
>>>
>>> public interface IDemoService {
>>>
>>>     /**
>>>      * Getter for property 'listOfAvailableFLVs'.
>>>      *
>>>      * @return Value for property 'listOfAvailableFLVs'.
>>>      */
>>>     public Map getListOfAvailableFLVs();
>>>
>>>     public Map getListOfAvailableFLVs(String string);
>>>
>>> }
>>>
>>> Estou conseguiu transmitir e assistir, mas não grava. Usando o exemplo do
>>> Red5 que usa também o oflaDemo grava direitinho. Queria dar uma olhada no
>>> fonte, ma sé um swf.
>>>
>>> Obrigado,
>>> Vinicius.
>>>
>>>
>>>
>>> 2009/7/8 Erko Bridee de Almeida Cabrera <erko.bri...@gmail.com>
>>>
>>> Vinicius,
>>>>
>>>> - então aonde você vai mudar não é no Flex...
>>>>
>>>> - você tem que implementar o suporte no lado do Red5, código java lá
>>>>
>>>> ----
>>>>
>>>> observe os arquivos em anexo:
>>>>
>>>> 1 - red5-web.xml
>>>> você vai precisar fazer essa configuração
>>>>
>>>> 2 - vai precisar implementar classes de suporte para gerenciar o stream
>>>> e efetuar a gravação
>>>> essas classes estão mapeadas no XML, veja a classe StreamManager.java é
>>>> nela que é
>>>> feito a gravação para arquivo do Stream, observe a linha 29, veja que
>>>> está monitorando *hostStream*
>>>>
>>>> 3 - observe a classe ActionScript
>>>> métodos:
>>>> - initConnection() > linha 71
>>>> ali é feito a conexão do Flex/Flash com o Red5
>>>>
>>>> - publish() > linha 80
>>>> observe o código do método, e importate observe a linha: 86
>>>>
>>>> ali você define a parte fundamental, lembre que lá na codificação de
>>>> suporte java no Red5, você está monitorando
>>>> a publicação com nome *hostStream* ali é onde você define no Flex/Flash
>>>> para publicar com esse nome, com isso
>>>> vai ser captado pela funcionalidade que irá gravar o vídeo no Red5
>>>>
>>>> ---
>>>>
>>>> será que ajudou em algo ? =D
>>>>
>>>> qq coisa diga ae o/
>>>>
>>>>
>>>> --
>>>> Att,
>>>> Erko Bridee de Almeida Cabrera
>>>> http://erkobridee.com/
>>>> http://gospel.erkobridee.com/
>>>> http://www.cwbfx.com/
>>>> http://www.portaljava.com/
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>
>
> --
> Att,
> Erko Bridee de Almeida Cabrera
> http://erkobridee.com/
> http://gospel.erkobridee.com/
> http://www.cwbfx.com/
> http://www.portaljava.com/
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para flexdev@googlegroups.com
Para sair da lista, envie um email em branco para 
flexdev-unsubscr...@googlegroups.com
Mais opções estão disponíveis em http://groups.google.com/group/flexdev
-~----------~----~----~----~------~----~------~--~---

Responder a