private void flex_FlashCallback(YoYoStudio.Controls.Winform.FlexCallbackCommand cmd, List <string> args) { switch (cmd) { case FlexCallbackCommand.AudioStateChanged: break; case FlexCallbackCommand.ExtendVideo: break; case FlexCallbackCommand.LoadComplete: CallFlash(FlexCommand.ConnectRTMP, "rtmp://129.223.253.33/oflaDemo"); CallFlash(FlexCommand.LoadMusics); break; case FlexCallbackCommand.None: break; case FlexCallbackCommand.ReportStatus: break; case FlexCallbackCommand.ScaleXDefault: break; case FlexCallbackCommand.ScaleXMirror: break; case FlexCallbackCommand.TakePicture: break; case FlexCallbackCommand.VideoStateChanged: break; case FlexCallbackCommand.ZoomIn: break; case FlexCallbackCommand.ZoomOut: break; default: break; } }
private void flex_FlashCallback(YoYoStudio.Controls.Winform.FlexCallbackCommand cmd, List <string> args) { PlayMusicWindowViewModel vm = DataContext as PlayMusicWindowViewModel; switch (cmd) { case FlexCallbackCommand.None: break; case FlexCallbackCommand.ReportStatus: if (args != null && args.Count == 1) { if (args[0] == FlexStatusStrings.ConnectSucceed) { //the connection has been setup with Red5 if (vm != null) { vm.RoomWindowVM.RoomCallback.StartMusicEvent += RoomCallback_StartMusicEvent; vm.RoomWindowVM.RoomCallback.TogglePauseMusicEvent += RoomCallback_TogglePauseMusicEvent; vm.RoomWindowVM.RoomCallback.SetMusicVolumeEvent += RoomCallback_SetMusicVolumeEvent; vm.RoomWindowVM.RoomCallback.SetPlayPositionEvent += RoomCallback_SetPlayPositionEvent; vm.RoomWindowVM.RoomCallback.StopMusicEvent += RoomCallback_StopMusicEvent; vm.RoomWindowVM.RoomCallback.ReportMusicStatusEvent += RoomCallback_ReportMusicStatusEvent; vm.RoomWindowVM.RoomCallback.UpdateMusicStatusEvent += RoomCallback_UpdateMusicStatusEvent; } } } break; case FlexCallbackCommand.LoadComplete: //flex control has been loaded. Next we will connect the Rmtp and load the musics if (vm != null) { CallFlash(FlexCommand.ConnectRTMP, vm.MusicRtmpUrl); CallFlash(FlexCommand.LoadMusics); SynchronizePlayStatus(); } break; case FlexCallbackCommand.PlayMusic: vm.RoomWindowVM.RoomClient.StartMusic(vm.RoomWindowVM.RoomVM.Id, vm.Me.Id, args[0]); break; case FlexCallbackCommand.StopMusic: vm.RoomWindowVM.RoomClient.StopMusic(vm.RoomWindowVM.RoomVM.Id, vm.Me.Id); break; case FlexCallbackCommand.SetPlayPosition: //vm.RoomWindowVM.RoomClient.SetPlayPosition(vm.RoomWindowVM.RoomVM.Id, vm.Me.Id, int.Parse(args[0])); break; case FlexCallbackCommand.SetVolume: //vm.RoomWindowVM.RoomClient.SetMusicVolume(vm.RoomWindowVM.RoomVM.Id, vm.Me.Id, int.Parse(args[0])); break; case FlexCallbackCommand.TogglePauseMusic: //if (args != null && args.Count == 1) //{ // if (args[0] == FlexStatusStrings.MusicPaused) // { // vm.RoomWindowVM.RoomClient.TogglePauseMusic(vm.RoomWindowVM.RoomVM.Id, vm.Me.Id, true); // } // else // { // vm.RoomWindowVM.RoomClient.TogglePauseMusic(vm.RoomWindowVM.RoomVM.Id, vm.Me.Id,false); // } //} break; default: break; } if (FlashCallback != null) { FlashCallback(cmd, args); } }