Browse Source

0017649: 【超声直播】【全程录制】录制的视频会采集客户端麦克风的声音

finlay 7 months ago
parent
commit
dfc1c40493

+ 1 - 1
fis/IPlatformService.cs

@@ -402,7 +402,7 @@ namespace fis
         /// </summary>
         /// <param name="fileTitle">录制文件主要前缀信息</param>
         /// <param name="micDeviceId">当前录制所采集麦克风设备的Id,如不设置,讲采用系统默认麦克风录制</param>
-        void StartRecording(string filePrefixTitle, string micDeviceId);
+        void StartRecording(string filePrefixTitle, string micDeviceId, bool isDeviceLive = false);
         /// <summary>
         /// 结束录制 
         /// </summary>

+ 2 - 2
fis/PlatformService.cs

@@ -568,7 +568,7 @@ namespace fis
             ;
         }
 
-        public void StartRecording(string filePrefixTitle, string micDeviceId)
+        public void StartRecording(string filePrefixTitle, string micDeviceId, bool isDeviceLive = false)
         {
             var recorder = RecorderManager.Instance;
             IntPtr windowHandle;
@@ -581,7 +581,7 @@ namespace fis
             {
                 windowHandle = AppManager.MainWindow.PlatformImpl.Handle.Handle;
             }
-            recorder.StartRecord(RecordModeEmum.WindowMode, windowHandle, micDeviceId, filePrefixTitle, string.Empty);
+            recorder.StartRecord(RecordModeEmum.WindowMode, windowHandle, micDeviceId, filePrefixTitle, string.Empty, isDeviceLive);
         }
 
         public void StopRecording()

+ 2 - 2
fis/ShellConfig.cs

@@ -32,8 +32,8 @@ namespace fis
 
 
         //Gets or sets the app host which is the web App's url
-        //public string AppHost { get; set; } = "192.168.6.107:9316";
-        public string AppHost { get; set; } = "app.fis.plus";
+        public string AppHost { get; set; } = "127.0.0.1:8080";
+        //public string AppHost { get; set; } = "app.fis.plus";
 
 
 

+ 2 - 2
fis/Win/RecorderManager.cs

@@ -172,7 +172,7 @@ namespace fis.Win
         /// <param name="windowAddress"></param>
         /// <param name="micDevice"></param>
         /// <param name="fileTitle"></param>
-        public void StartRecord(RecordModeEmum recordMode, IntPtr windowAddress,string micDevice,string fileTitle,string pullUrl)
+        public void StartRecord(RecordModeEmum recordMode, IntPtr windowAddress,string micDevice,string fileTitle,string pullUrl,bool isDeviceLive = false)
         {
             _recordMode = recordMode;
             if (IsRecording)
@@ -189,7 +189,7 @@ namespace fis.Win
                     {
                         _windowRecorder = new RecorderPusher(windowAddress, micDeviceId, AudioMode.Mix);
                         _windowRecorder.SetRecordParameter(_recordFolderCachePath, _maxSize, Guid.NewGuid().ToString(), true);
-                        _windowRecorder.Record();
+                        _windowRecorder.Record(isDeviceLive);
                     }
                     else if(_recordMode==RecordModeEmum.UrlPullMode){
                         _trainningLiveManager = AppManager.Get<ITrainningLiveManager>();

+ 4 - 4
fis/Win/RecorderPusher.cs

@@ -64,13 +64,13 @@ namespace fis.Win
             }
         }
 
-        public override void Record()
+        public override void Record(bool isDeviceLive = false)
         {
             if (!_recording)
             {
                 if (PusherHandle == IntPtr.Zero)
                 {
-                    if (!OpenPublisherHandle())
+                    if (!OpenPublisherHandle(isDeviceLive? NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_CAPTURE_SPEAKER : NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_CAPTURE_MIC_SPEAKER_MIXER))
                     {
                         return;
                     }
@@ -161,7 +161,7 @@ namespace fis.Win
             }
         }
 
-        private bool OpenPublisherHandle()
+        private bool OpenPublisherHandle(NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION nt_pb_e_audio_option)
         {
             if (PusherHandle != IntPtr.Zero)
             {
@@ -169,7 +169,7 @@ namespace fis.Win
             }
 
             var video_option = (UInt32)NTSmartPublisherDefine.NT_PB_E_VIDEO_OPTION.NT_PB_E_VIDEO_OPTION_WINDOW;
-            var audio_option = (UInt32)NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_CAPTURE_MIC_SPEAKER_MIXER;
+            var audio_option = (UInt32)nt_pb_e_audio_option;
             var ret = NTSmartPublisherSDK.NT_PB_Open(out PusherHandle, video_option, audio_option, 0, IntPtr.Zero);
 
 

+ 1 - 1
fis/Win/RtmpPublisher.cs

@@ -712,7 +712,7 @@ namespace fis.Win
 
         }
 
-        public virtual void Record()
+        public virtual void Record(bool isDeviceLive = false)
         {
         }