|
ÒôÊÓƵ¼ÖÆÊÇÒôÊÓƵ½â¾ö·½°¸ÖÐ×îÖØÒªµÄ¹¦ÄÜÌØÐÔÖ®Ò»£¬ÌرðÊÇһЩÐÐÒµÓ¦ÓÃÖÐÒôÊÓƵ¼ÖÆÊÇ×î»ù±¾µÄ¹¦ÄÜÐèÇó£¬AnyChat×÷Ϊҵ½çÒ»Á÷µÄ¿çƽ̨ÒôÊÓƵ½â¾ö·½°¸£¬ÔÚÒôÊÓƵ¼ÖÆ·½ÃæÒ²ÌṩÁ˷dz£ÍêÉƵÄÕûÌå½â¾ö·½°¸£¬¸ÅÀ¨ÆðÀ´ÓÐÈçÏÂÌص㣺
Ò»¡¢API½Ó¿Ú¶¨Òå
AnyChatÔÚ¿Í»§¶ËÌṩµÄ¼ÖÆAPI½Ó¿ÚÓë»Øµ÷ʼþΪ£º- // Óû§Òô¡¢ÊÓƵ¼ÖÆ£¨À©Õ¹£©
- BRAC_API DWORD BRAC_StreamRecordCtrlEx(DWORD dwUserId, BOOL bStartRecord, DWORD dwFlags, DWORD dwParam, LPCTSTR lpUserStr);
- // ¼Ïñ¡¢¿ìÕÕÈÎÎñÍê³ÉÀ©Õ¹»Øµ÷º¯Êý¶¨Òå
- typedef void (CALLBACK * BRAC_RecordSnapShotEx_CallBack)(DWORD dwUserId, LPCTSTR lpFileName, DWORD dwElapse, DWORD dwFlags, DWORD dwParam, LPCTSTR lpUserStr, LPVOID lpUserValue);
¸´ÖÆ´úÂë AnyChatÔÚ·þÎñÆ÷¶ËÌṩµÄ¼ÖÆAPI½Ó¿ÚÓë»Øµ÷ʼþΪ£º- // ÖÐÐĶ˼Ïñ¿ØÖÆ£¨À©Õ¹£©
- BRAS_API DWORD BRAS_StreamRecordCtrlEx(DWORD dwUserId, BOOL bStartRecord, DWORD dwFlags, DWORD dwParam, LPCTSTR lpUserStr=NULL, DWORD dwRecordServerId=-1);
- // ·þÎñÆ÷¼Ïñ»Øµ÷º¯Êý¶¨Ò壨À©Õ¹£©
- typedef void (CALLBACK * BRAS_OnServerRecordEx_CallBack)(DWORD dwUserId, LPCTSTR lpFileName, DWORD dwElapse, DWORD dwFlags, DWORD dwParam, LPCTSTR lpUserStr, DWORD dwRecordServerId, LPVOID lpUserValue);
¸´ÖÆ´úÂë ¶þ¡¢Â¼ÖÆAPIµ÷ÓÃ
APIµÚÒ»¸ö²ÎÊý±íʾ¼ÖƶÔÏó£¬Ö¸Â¼ÖÆijһ¸öÓû§µÄÒôÊÓƵ£¬¶ÔÓںϳɼÖÆ£¬Ö»ÐèҪͨ¹ýµÚÈý¸ö²ÎÊý£¨dwFlags£©¼ÓÈëÌض¨µÄ±êÖ¾¼´¿ÉʵÏÖ¡£
¿ªÊ¼Â¼ÖÆÒÔ¼°Í£Ö¹Â¼Öƾùµ÷ÓÃͬһ¸öAPI½Ó¿Ú£¨Èç¿Í»§¶ËΪ£ºBRAC_StreamRecordCtrlEx£©£¬Í¨¹ýµÚ¶þ¸ö²ÎÊý£¨bStartRecord£©À´¿ØÖÆ£¬µ±bStartRecord=TRUE£¨1£©Ê±£¬±íʾ¿ªÊ¼Â¼ÖÆ£¬µ±bStartRecord=FALSE£¨0£©Ê±£¬±íʾֹͣ¼ÖÆ¡£
µ±µ÷ÓÃAPI¿ªÊ¼Â¼ÖÆʱ£¬Ï൱ÓÚÏ´ïÁËÒ»¸ö¼ÖÆÈÎÎñ£¬AnyChatÄں˽«¿ªÊ¼Â¼ÖÆ£¬¿ÉÒÔÔÚ¿Í»§¶Ëµ÷ÓÃAPI£¨BRAC_QueryUserState£©À´²éѯ¼ÖÆ״̬£»Í¨¹ýµÚÈý¸ö²ÎÊý£¨dwFlags£©¿É¿ØÖƼÖÆÐÐΪ£ºÊÇÔÚ¿Í»§¶Ë¼ÖÆ£¬»¹ÊÇÔÚ·þÎñÆ÷¼ÖÆ£»ÊǼÖÆÒôƵ£¬»¹ÊÇÒôÊÓƵһͬ¼ÖÆ£»ÊǼÖƵ¥¸öÓû§£¬»¹ÊÇͨ»°Ë«·½ºÏ³É¼ÖƵȣ¬¾ßÌåÓ¦Óÿɲο¼ºóÐøµÄ¡°Â¼Öƹ¦ÄÜʾÀý¡±²¿·Ö¡£
µ±µ÷ÓÃAPIֹͣ¼ÖÆʱ£¬AnyChatÄں˻á½áÊø¼ÖÆÈÎÎñ£¬Í¬Ê±´¥·¢ÉϲãÓ¦ÓõĻص÷ʼþ£¨Èç¿Í»§¶ËΪ£ºBRAC_RecordSnapShotEx_CallBack£©£¬Ôڻص÷ʼþÖУ¬½«Â¼ÖÆÎļþÃû£¨º¬Â·¾¶£©¡¢Â¼ÖÆʱ³¤¡¢Óû§×Ô¶¨Òå²ÎÊýµÈÐÅÏ¢·µ»Ø¸øÉϲãÓ¦Óá£
AnyChatÄÚºËÌṩÁËÁ½¸ö×Ô¶¨Òå²ÎÊý£¬Ò»¸öÊÇÕûÐΣ¨dwParam£©£¬Ò»¸öÊÇ×Ö·û´®ÀàÐÍ£¨lpUserStr£©£¬ÔÚ¿ªÊ¼Â¼ÖÆ£¨»ò½áÊø¼ÖÆ£©Ê±Í¨¹ýAPI½Ó¿Ú´«È룬Èç¹û¿ªÊ¼Â¼ÖÆ¡¢½áÊø¼ÖƾùΪ´«È룬ÔòÒÔ½áÊø¼ÖÆʱµÄֵΪ׼£¬ÔÚ¼ÖÆÍê³É»Øµ÷ʼþÖзµ»Ø¸øÉϲãÓ¦Óã¬Èç¿ÉÒÔͨ¹ý×Ö·û´®ÀàÐÍ×Ô¶¨Òå²ÎÊýÀ´´«ÊäÒ»¸öÉϲãÓ¦ÓõÄÒµÎñÁ÷Ë®ºÅ£¬Ôò¿ÉÒÔʵÏÖÔڻص÷ʼþÖн«Â¼ÖƵÄÎļþÃûÓëÒµÎñÁ÷Ë®ºÅ½øÐйØÁª£¬±£´æÔÚÊý¾Ý¿âÖеȹ¦ÄÜ¡£
Èý¡¢Â¼Öƹ¦ÄÜʾÀý
ÏÂÃæÒÔJavaScript½Å±¾ÎªÀý£¬Õë¶Ô³£ÓõļÖƹ¦Äܸø³öʾÀý´úÂ룺
1¡¢¿Í»§¶Ë¶Ôµ¥¸öÓû§µÄÒôƵ¡¢ÊÓƵ½øÐмÖÆ£¬Â¼ÖÆΪMP4¸ñʽ- BRAC_SetSDKOption(BRAC_SO_RECORD_FILETYPE, 0); // ¼ÖÆΪMP4¸ñʽ
- var dwFlags = ANYCHAT_RECORD_FLAGS_VIDEO + ANYCHAT_RECORD_FLAGS_AUDIO;
- BRAC_StreamRecordCtrlEx(userid, 1, dwFlags, 0, "Hello, world!");
¸´ÖÆ´úÂë 2¡¢¿Í»§¶Ë¶Ôµ¥¸öÓû§µÄÒôƵ½øÐмÖÆ£¬Â¼ÖÆΪMP3¸ñʽ- BRAC_SetSDKOption(BRAC_SO_RECORD_FILETYPE, 3); // ¼ÖÆΪMP3¸ñʽ
- var dwFlags = ANYCHAT_RECORD_FLAGS_AUDIO;
- BRAC_StreamRecordCtrlEx(userid, 1, dwFlags, 0, "Hello, world!");
¸´ÖÆ´úÂë 3¡¢¿Í»§¶Ë¶Ôͨ»°Ë«·½µÄÒôƵ¡¢ÊÓƵ½øÐмÖÆ£¬Â¼ÖÆΪMP4¸ñʽ£¬»Öлģʽ£º- BRAC_SetSDKOption(BRAC_SO_RECORD_FILETYPE, 0); // ¼ÖÆΪMP4¸ñʽ
- var dwFlags = ANYCHAT_RECORD_FLAGS_VIDEO + ANYCHAT_RECORD_FLAGS_AUDIO + ANYCHAT_RECORD_FLAGS_MIXVIDEO + ANYCHAT_RECORD_FLAGS_MIXAUDIO;
- BRAC_StreamRecordCtrlEx(userid, 1, dwFlags, 0, "Hello, world!");
¸´ÖÆ´úÂë ËÄ¡¢ÆäËü
1¡¢¿Í»§¶Ë¿ÉÒÔͨ¹ýAPI£ºBRAC_SetSDKOption(BRAC_SO_RECORD_TMPDIR, path)À´ÉèÖüÏñÎļþ±£´æ·¾¶£»
2¡¢¿Í»§¶Ë¿ÉÒÔͨ¹ýAPI£ºBRAC_SetSDKOption(BRAC_SO_RECORD_VIDEOBR, bitrate)À´ÉèÖüÖÆÊÓƵµÄÖÊÁ¿£¬µ÷½Ú¼ÖÆÊÓƵµÄÇåÎú¶È£»
3¡¢ÓйؼÏñÎļþ¸ÄÃû£¬ÓÐÁ½ÖÖ·½Ê½À´ÊµÏÖ£º
·½Ê½Ò»£ºÂ¼ÖÆÍê³ÉÖ®ºó£¬AnyChat½«´¥·¢ÉϲãÓ¦ÓõļÖÆÍê³É»Øµ÷ʼþ£¬Ôڻص÷ʼþÖзµ»Ø¼ÖÆÎļþÃû£¨º¬Â·¾¶£©£¬ÉϲãÓ¦ÓÿÉÒÔÔڻص÷ʼþÖе÷ÓòÙ×÷ϵͳÌṩµÄÎļþ¸ÄÃûº¯Êý£¨ÈçWindowsƽ̨Ϊ£ºMoveFileº¯Êý£©¶ÔÎļþ½øÐиÄÃû²Ù×÷£»
·½Ê½¶þ£ºÀûÓÃAnyChat×Ô¶¨Òå¼ÏñÎļþÃûµÄ¹¦ÄÜ£¬ÔÚ¿ªÊ¼Â¼ÖÆʱ£¬Í¨¹ýlpUserStr²ÎÊý´«ÈëJson¸ñʽµÄ¼ÏñÎļþÃû£»
4¡¢ÓйؼÖÆÍê³É»Øµ÷ʼþÖС°lpUserStr¡±µÄÖµ£¬Èç¹û½áÊø¼ÖÆʱ£¬µ÷ÓÃAPI£ºBRAC_StreamRecordCtrlExÓд«ÈëlpUserStrµÄÖµ£¬Ôò»Øµ÷ÒÔ½áÊø¼ÖÆʱ´«ÈëֵΪ׼£¬·ñÔòÒÔ¿ªÊ¼Â¼ÖÆʱ´«ÈëֵΪ׼¡£
²Î¿¼£º
1¡¢ÓйØÖÐÐļÏñ·þÎñÆ÷²¿Êð¿É²Î¿¼£ºWindowsƽ̨ÖÐÐļÏñ·þÎñÆ÷²¿Êð¡¢Linuxƽ̨ÖÐÐļÏñ·þÎñÆ÷²¿Êð£»
2¡¢ÓйØÖÐÐļÏñ·þÎñÆ÷ÅäÖÃÏRecordRootURL¡¿µÄ˵Ã÷
3¡¢ÓйØÖÐÐļÏñ·þÎñÆ÷ÅäÖÃÏRecordCacheDir¡¿µÄ˵Ã÷
|
|