Nav apraksta

IAgoraRtcEngine.h 329KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474
  1. //
  2. // AgoraRtcEngine SDK
  3. //
  4. // Copyright (c) 2019 Agora.io. All rights reserved.
  5. //
  6. /**
  7. @defgroup createAgoraRtcEngine Create an AgoraRtcEngine
  8. */
  9. #ifndef AGORA_RTC_ENGINE_H
  10. #define AGORA_RTC_ENGINE_H
  11. #include "AgoraBase.h"
  12. #include "IAgoraService.h"
  13. namespace agora {
  14. namespace rtc {
  15. typedef unsigned int uid_t;
  16. typedef void* view_t;
  17. /** Maximum length of the device ID.
  18. */
  19. enum MAX_DEVICE_ID_LENGTH_TYEP
  20. {
  21. /** The maximum length of the device ID is 512 bytes.
  22. */
  23. MAX_DEVICE_ID_LENGTH = 512
  24. };
  25. /** Maximum length of user account.
  26. */
  27. enum MAX_USER_ACCOUNT_LENGTH_TYPE
  28. {
  29. /** The maximum length of user account is 255 bytes.
  30. */
  31. MAX_USER_ACCOUNT_LENGTH = 256
  32. };
  33. /** Formats of the quality report.
  34. */
  35. enum QUALITY_REPORT_FORMAT_TYPE
  36. {
  37. /** 0: The quality report in JSON format,
  38. */
  39. QUALITY_REPORT_JSON = 0,
  40. /** 1: The quality report in HTML format.
  41. */
  42. QUALITY_REPORT_HTML = 1,
  43. };
  44. enum MEDIA_ENGINE_EVENT_CODE_TYPE
  45. {
  46. /** 0: For internal use only.
  47. */
  48. MEDIA_ENGINE_RECORDING_ERROR = 0,
  49. /** 1: For internal use only.
  50. */
  51. MEDIA_ENGINE_PLAYOUT_ERROR = 1,
  52. /** 2: For internal use only.
  53. */
  54. MEDIA_ENGINE_RECORDING_WARNING = 2,
  55. /** 3: For internal use only.
  56. */
  57. MEDIA_ENGINE_PLAYOUT_WARNING = 3,
  58. /** 10: For internal use only.
  59. */
  60. MEDIA_ENGINE_AUDIO_FILE_MIX_FINISH = 10,
  61. /** 12: For internal use only.
  62. */
  63. MEDIA_ENGINE_AUDIO_FAREND_MUSIC_BEGINS = 12,
  64. /** 13: For internal use only.
  65. */
  66. MEDIA_ENGINE_AUDIO_FAREND_MUSIC_ENDS = 13,
  67. /** 14: For internal use only.
  68. */
  69. MEDIA_ENGINE_LOCAL_AUDIO_RECORD_ENABLED = 14,
  70. /** 15: For internal use only.
  71. */
  72. MEDIA_ENGINE_LOCAL_AUDIO_RECORD_DISABLED = 15,
  73. // media engine role changed
  74. /** 20: For internal use only.
  75. */
  76. MEDIA_ENGINE_ROLE_BROADCASTER_SOLO = 20,
  77. /** 21: For internal use only.
  78. */
  79. MEDIA_ENGINE_ROLE_BROADCASTER_INTERACTIVE = 21,
  80. /** 22: For internal use only.
  81. */
  82. MEDIA_ENGINE_ROLE_AUDIENCE = 22,
  83. /** 23: For internal use only.
  84. */
  85. MEDIA_ENGINE_ROLE_COMM_PEER = 23,
  86. /** 24: For internal use only.
  87. */
  88. MEDIA_ENGINE_ROLE_GAME_PEER = 24,
  89. // iOS adm sample rate changed
  90. /** 110: For internal use only.
  91. */
  92. MEDIA_ENGINE_AUDIO_ADM_REQUIRE_RESTART = 110,
  93. /** 111: For internal use only.
  94. */
  95. MEDIA_ENGINE_AUDIO_ADM_SPECIAL_RESTART = 111,
  96. /** 112: For internal use only.
  97. */
  98. MEDIA_ENGINE_AUDIO_ADM_USING_COMM_PARAMS = 112,
  99. /** 113: For internal use only.
  100. */
  101. MEDIA_ENGINE_AUDIO_ADM_USING_NORM_PARAMS = 113,
  102. // audio mix state
  103. /** 710: For internal use only.
  104. */
  105. MEDIA_ENGINE_AUDIO_EVENT_MIXING_PLAY = 710,
  106. /** 711: For internal use only.
  107. */
  108. MEDIA_ENGINE_AUDIO_EVENT_MIXING_PAUSED = 711,
  109. /** 712: For internal use only.
  110. */
  111. MEDIA_ENGINE_AUDIO_EVENT_MIXING_RESTART = 712,
  112. /** 713: For internal use only.
  113. */
  114. MEDIA_ENGINE_AUDIO_EVENT_MIXING_STOPPED = 713,
  115. /** 714: For internal use only.
  116. */
  117. MEDIA_ENGINE_AUDIO_EVENT_MIXING_ERROR = 714,
  118. //Mixing error codes
  119. /** 701: For internal use only.
  120. */
  121. MEDIA_ENGINE_AUDIO_ERROR_MIXING_OPEN = 701,
  122. /** 702: For internal use only.
  123. */
  124. MEDIA_ENGINE_AUDIO_ERROR_MIXING_TOO_FREQUENT = 702,
  125. /** 703: The audio mixing file playback is interrupted. For internal use only.
  126. */
  127. MEDIA_ENGINE_AUDIO_ERROR_MIXING_INTERRUPTED_EOF = 703,
  128. /** 0: For internal use only.
  129. */
  130. MEDIA_ENGINE_AUDIO_ERROR_MIXING_NO_ERROR = 0,
  131. };
  132. /** The states of the local user's audio mixing file.
  133. */
  134. enum AUDIO_MIXING_STATE_TYPE{
  135. /** 710: The audio mixing file is playing.
  136. */
  137. AUDIO_MIXING_STATE_PLAYING = 710,
  138. /** 711: The audio mixing file pauses playing.
  139. */
  140. AUDIO_MIXING_STATE_PAUSED = 711,
  141. /** 713: The audio mixing file stops playing.
  142. */
  143. AUDIO_MIXING_STATE_STOPPED = 713,
  144. /** 714: An exception occurs when playing the audio mixing file. See #AUDIO_MIXING_ERROR_TYPE.
  145. */
  146. AUDIO_MIXING_STATE_FAILED = 714,
  147. };
  148. /** The error codes of the local user's audio mixing file.
  149. */
  150. enum AUDIO_MIXING_ERROR_TYPE{
  151. /** 701: The SDK cannot open the audio mixing file.
  152. */
  153. AUDIO_MIXING_ERROR_CAN_NOT_OPEN = 701,
  154. /** 702: The SDK opens the audio mixing file too frequently.
  155. */
  156. AUDIO_MIXING_ERROR_TOO_FREQUENT_CALL = 702,
  157. /** 703: The audio mixing file playback is interrupted.
  158. */
  159. AUDIO_MIXING_ERROR_INTERRUPTED_EOF = 703,
  160. /** 0: The SDK can open the audio mixing file.
  161. */
  162. AUDIO_MIXING_ERROR_OK = 0,
  163. };
  164. /** Media device states.
  165. */
  166. enum MEDIA_DEVICE_STATE_TYPE
  167. {
  168. /** 1: The device is active.
  169. */
  170. MEDIA_DEVICE_STATE_ACTIVE = 1,
  171. /** 2: The device is disabled.
  172. */
  173. MEDIA_DEVICE_STATE_DISABLED = 2,
  174. /** 4: The device is not present.
  175. */
  176. MEDIA_DEVICE_STATE_NOT_PRESENT = 4,
  177. /** 8: The device is unplugged.
  178. */
  179. MEDIA_DEVICE_STATE_UNPLUGGED = 8
  180. };
  181. /** Media device types.
  182. */
  183. enum MEDIA_DEVICE_TYPE
  184. {
  185. /** -1: Unknown device type.
  186. */
  187. UNKNOWN_AUDIO_DEVICE = -1,
  188. /** 0: Audio playback device.
  189. */
  190. AUDIO_PLAYOUT_DEVICE = 0,
  191. /** 1: Audio recording device.
  192. */
  193. AUDIO_RECORDING_DEVICE = 1,
  194. /** 2: Video renderer.
  195. */
  196. VIDEO_RENDER_DEVICE = 2,
  197. /** 3: Video capturer.
  198. */
  199. VIDEO_CAPTURE_DEVICE = 3,
  200. /** 4: Application audio playback device.
  201. */
  202. AUDIO_APPLICATION_PLAYOUT_DEVICE = 4,
  203. };
  204. /** Local video state types
  205. */
  206. enum LOCAL_VIDEO_STREAM_STATE
  207. {
  208. /** Initial state */
  209. LOCAL_VIDEO_STREAM_STATE_STOPPED = 0,
  210. /** The capturer starts successfully. */
  211. LOCAL_VIDEO_STREAM_STATE_CAPTURING = 1,
  212. /** The first video frame is successfully encoded. */
  213. LOCAL_VIDEO_STREAM_STATE_ENCODING = 2,
  214. /** The local video fails to start. */
  215. LOCAL_VIDEO_STREAM_STATE_FAILED = 3
  216. };
  217. /** Local video state error codes
  218. */
  219. enum LOCAL_VIDEO_STREAM_ERROR {
  220. /** The local video is normal. */
  221. LOCAL_VIDEO_STREAM_ERROR_OK = 0,
  222. /** No specified reason for the local video failure. */
  223. LOCAL_VIDEO_STREAM_ERROR_FAILURE = 1,
  224. /** No permission to use the local video device. */
  225. LOCAL_VIDEO_STREAM_ERROR_DEVICE_NO_PERMISSION = 2,
  226. /** The local video capturer is in use. */
  227. LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY = 3,
  228. /** The local video capture fails. Check whether the capturer is working properly. */
  229. LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE = 4,
  230. /** The local video encoding fails. */
  231. LOCAL_VIDEO_STREAM_ERROR_ENCODE_FAILURE = 5
  232. };
  233. /** Local audio state types.
  234. */
  235. enum LOCAL_AUDIO_STREAM_STATE
  236. {
  237. /** 0: The local audio is in the initial state.
  238. */
  239. LOCAL_AUDIO_STREAM_STATE_STOPPED = 0,
  240. /** 1: The recording device starts successfully.
  241. */
  242. LOCAL_AUDIO_STREAM_STATE_RECORDING = 1,
  243. /** 2: The first audio frame encodes successfully.
  244. */
  245. LOCAL_AUDIO_STREAM_STATE_ENCODING = 2,
  246. /** 3: The local audio fails to start.
  247. */
  248. LOCAL_AUDIO_STREAM_STATE_FAILED = 3
  249. };
  250. /** Local audio state error codes.
  251. */
  252. enum LOCAL_AUDIO_STREAM_ERROR
  253. {
  254. /** 0: The local audio is normal.
  255. */
  256. LOCAL_AUDIO_STREAM_ERROR_OK = 0,
  257. /** 1: No specified reason for the local audio failure.
  258. */
  259. LOCAL_AUDIO_STREAM_ERROR_FAILURE = 1,
  260. /** 2: No permission to use the local audio device.
  261. */
  262. LOCAL_AUDIO_STREAM_ERROR_DEVICE_NO_PERMISSION = 2,
  263. /** 3: The microphone is in use.
  264. */
  265. LOCAL_AUDIO_STREAM_ERROR_DEVICE_BUSY = 3,
  266. /** 4: The local audio recording fails. Check whether the recording device
  267. * is working properly.
  268. */
  269. LOCAL_AUDIO_STREAM_ERROR_RECORD_FAILURE = 4,
  270. /** 5: The local audio encoding fails.
  271. */
  272. LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE = 5
  273. };
  274. /** Audio recording qualities.
  275. */
  276. enum AUDIO_RECORDING_QUALITY_TYPE
  277. {
  278. /** 0: Low quality. The sample rate is 32 kHz, and the file size is around
  279. * 1.2 MB after 10 minutes of recording.
  280. */
  281. AUDIO_RECORDING_QUALITY_LOW = 0,
  282. /** 1: Medium quality. The sample rate is 32 kHz, and the file size is
  283. * around 2 MB after 10 minutes of recording.
  284. */
  285. AUDIO_RECORDING_QUALITY_MEDIUM = 1,
  286. /** 2: High quality. The sample rate is 32 kHz, and the file size is
  287. * around 3.75 MB after 10 minutes of recording.
  288. */
  289. AUDIO_RECORDING_QUALITY_HIGH = 2,
  290. };
  291. /** Network quality types. */
  292. enum QUALITY_TYPE
  293. {
  294. /** 0: The network quality is unknown. */
  295. QUALITY_UNKNOWN = 0,
  296. /** 1: The network quality is excellent. */
  297. QUALITY_EXCELLENT = 1,
  298. /** 2: The network quality is quite good, but the bitrate may be slightly lower than excellent. */
  299. QUALITY_GOOD = 2,
  300. /** 3: Users can feel the communication slightly impaired. */
  301. QUALITY_POOR = 3,
  302. /** 4: Users cannot communicate smoothly. */
  303. QUALITY_BAD = 4,
  304. /** 5: The network is so bad that users can barely communicate. */
  305. QUALITY_VBAD = 5,
  306. /** 6: The network is down and users cannot communicate at all. */
  307. QUALITY_DOWN = 6,
  308. /** 7: Users cannot detect the network quality. (Not in use.) */
  309. QUALITY_UNSUPPORTED = 7,
  310. /** 8: Detecting the network quality. */
  311. QUALITY_DETECTING = 8,
  312. };
  313. /** Video display modes. */
  314. enum RENDER_MODE_TYPE
  315. {
  316. /**
  317. 1: Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents.
  318. */
  319. RENDER_MODE_HIDDEN = 1,
  320. /**
  321. 2: Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to disparity in the aspect ratio are filled with black.
  322. */
  323. RENDER_MODE_FIT = 2,
  324. /** **DEPRECATED** 3: This mode is deprecated.
  325. */
  326. RENDER_MODE_ADAPTIVE = 3,
  327. };
  328. /** Video mirror modes. */
  329. enum VIDEO_MIRROR_MODE_TYPE
  330. {
  331. /** 0: The default mirror mode is determined by the SDK. */
  332. VIDEO_MIRROR_MODE_AUTO = 0,//determined by SDK
  333. /** 1: Enable mirror mode. */
  334. VIDEO_MIRROR_MODE_ENABLED = 1,//enabled mirror
  335. /** 2: Disable mirror mode. */
  336. VIDEO_MIRROR_MODE_DISABLED = 2,//disable mirror
  337. };
  338. /** **DEPRECATED** Video profiles. */
  339. enum VIDEO_PROFILE_TYPE
  340. {
  341. /** 0: 160 × 120, frame rate 15 fps, bitrate 65 Kbps. */
  342. VIDEO_PROFILE_LANDSCAPE_120P = 0,
  343. /** 2: 120 × 120, frame rate 15 fps, bitrate 50 Kbps. */
  344. VIDEO_PROFILE_LANDSCAPE_120P_3 = 2,
  345. /** 10: 320×180, frame rate 15 fps, bitrate 140 Kbps. */
  346. VIDEO_PROFILE_LANDSCAPE_180P = 10,
  347. /** 12: 180 × 180, frame rate 15 fps, bitrate 100 Kbps. */
  348. VIDEO_PROFILE_LANDSCAPE_180P_3 = 12,
  349. /** 13: 240 × 180, frame rate 15 fps, bitrate 120 Kbps. */
  350. VIDEO_PROFILE_LANDSCAPE_180P_4 = 13,
  351. /** 20: 320 × 240, frame rate 15 fps, bitrate 200 Kbps. */
  352. VIDEO_PROFILE_LANDSCAPE_240P = 20,
  353. /** 22: 240 × 240, frame rate 15 fps, bitrate 140 Kbps. */
  354. VIDEO_PROFILE_LANDSCAPE_240P_3 = 22,
  355. /** 23: 424 × 240, frame rate 15 fps, bitrate 220 Kbps. */
  356. VIDEO_PROFILE_LANDSCAPE_240P_4 = 23,
  357. /** 30: 640 × 360, frame rate 15 fps, bitrate 400 Kbps. */
  358. VIDEO_PROFILE_LANDSCAPE_360P = 30,
  359. /** 32: 360 × 360, frame rate 15 fps, bitrate 260 Kbps. */
  360. VIDEO_PROFILE_LANDSCAPE_360P_3 = 32,
  361. /** 33: 640 × 360, frame rate 30 fps, bitrate 600 Kbps. */
  362. VIDEO_PROFILE_LANDSCAPE_360P_4 = 33,
  363. /** 35: 360 × 360, frame rate 30 fps, bitrate 400 Kbps. */
  364. VIDEO_PROFILE_LANDSCAPE_360P_6 = 35,
  365. /** 36: 480 × 360, frame rate 15 fps, bitrate 320 Kbps. */
  366. VIDEO_PROFILE_LANDSCAPE_360P_7 = 36,
  367. /** 37: 480 × 360, frame rate 30 fps, bitrate 490 Kbps. */
  368. VIDEO_PROFILE_LANDSCAPE_360P_8 = 37,
  369. /** 38: 640 × 360, frame rate 15 fps, bitrate 800 Kbps.
  370. @note Live broadcast profile only.
  371. */
  372. VIDEO_PROFILE_LANDSCAPE_360P_9 = 38,
  373. /** 39: 640 × 360, frame rate 24 fps, bitrate 800 Kbps.
  374. @note Live broadcast profile only.
  375. */
  376. VIDEO_PROFILE_LANDSCAPE_360P_10 = 39,
  377. /** 100: 640 × 360, frame rate 24 fps, bitrate 1000 Kbps.
  378. @note Live broadcast profile only.
  379. */
  380. VIDEO_PROFILE_LANDSCAPE_360P_11 = 100,
  381. /** 40: 640 × 480, frame rate 15 fps, bitrate 500 Kbps. */
  382. VIDEO_PROFILE_LANDSCAPE_480P = 40,
  383. /** 42: 480 × 480, frame rate 15 fps, bitrate 400 Kbps. */
  384. VIDEO_PROFILE_LANDSCAPE_480P_3 = 42,
  385. /** 43: 640 × 480, frame rate 30 fps, bitrate 750 Kbps. */
  386. VIDEO_PROFILE_LANDSCAPE_480P_4 = 43,
  387. /** 45: 480 × 480, frame rate 30 fps, bitrate 600 Kbps. */
  388. VIDEO_PROFILE_LANDSCAPE_480P_6 = 45,
  389. /** 47: 848 × 480, frame rate 15 fps, bitrate 610 Kbps. */
  390. VIDEO_PROFILE_LANDSCAPE_480P_8 = 47,
  391. /** 48: 848 × 480, frame rate 30 fps, bitrate 930 Kbps. */
  392. VIDEO_PROFILE_LANDSCAPE_480P_9 = 48,
  393. /** 49: 640 × 480, frame rate 10 fps, bitrate 400 Kbps. */
  394. VIDEO_PROFILE_LANDSCAPE_480P_10 = 49,
  395. /** 50: 1280 × 720, frame rate 15 fps, bitrate 1130 Kbps. */
  396. VIDEO_PROFILE_LANDSCAPE_720P = 50,
  397. /** 52: 1280 × 720, frame rate 30 fps, bitrate 1710 Kbps. */
  398. VIDEO_PROFILE_LANDSCAPE_720P_3 = 52,
  399. /** 54: 960 × 720, frame rate 15 fps, bitrate 910 Kbps. */
  400. VIDEO_PROFILE_LANDSCAPE_720P_5 = 54,
  401. /** 55: 960 × 720, frame rate 30 fps, bitrate 1380 Kbps. */
  402. VIDEO_PROFILE_LANDSCAPE_720P_6 = 55,
  403. /** 60: 1920 × 1080, frame rate 15 fps, bitrate 2080 Kbps. */
  404. VIDEO_PROFILE_LANDSCAPE_1080P = 60,
  405. /** 62: 1920 × 1080, frame rate 30 fps, bitrate 3150 Kbps. */
  406. VIDEO_PROFILE_LANDSCAPE_1080P_3 = 62,
  407. /** 64: 1920 × 1080, frame rate 60 fps, bitrate 4780 Kbps. */
  408. VIDEO_PROFILE_LANDSCAPE_1080P_5 = 64,
  409. /** 66: 2560 × 1440, frame rate 30 fps, bitrate 4850 Kbps. */
  410. VIDEO_PROFILE_LANDSCAPE_1440P = 66,
  411. /** 67: 2560 × 1440, frame rate 60 fps, bitrate 6500 Kbps. */
  412. VIDEO_PROFILE_LANDSCAPE_1440P_2 = 67,
  413. /** 70: 3840 × 2160, frame rate 30 fps, bitrate 6500 Kbps. */
  414. VIDEO_PROFILE_LANDSCAPE_4K = 70,
  415. /** 72: 3840 × 2160, frame rate 60 fps, bitrate 6500 Kbps. */
  416. VIDEO_PROFILE_LANDSCAPE_4K_3 = 72,
  417. /** 1000: 120 × 160, frame rate 15 fps, bitrate 65 Kbps. */
  418. VIDEO_PROFILE_PORTRAIT_120P = 1000,
  419. /** 1002: 120 × 120, frame rate 15 fps, bitrate 50 Kbps. */
  420. VIDEO_PROFILE_PORTRAIT_120P_3 = 1002,
  421. /** 1010: 180 × 320, frame rate 15 fps, bitrate 140 Kbps. */
  422. VIDEO_PROFILE_PORTRAIT_180P = 1010,
  423. /** 1012: 180 × 180, frame rate 15 fps, bitrate 100 Kbps. */
  424. VIDEO_PROFILE_PORTRAIT_180P_3 = 1012,
  425. /** 1013: 180 × 240, frame rate 15 fps, bitrate 120 Kbps. */
  426. VIDEO_PROFILE_PORTRAIT_180P_4 = 1013,
  427. /** 1020: 240 × 320, frame rate 15 fps, bitrate 200 Kbps. */
  428. VIDEO_PROFILE_PORTRAIT_240P = 1020,
  429. /** 1022: 240 × 240, frame rate 15 fps, bitrate 140 Kbps. */
  430. VIDEO_PROFILE_PORTRAIT_240P_3 = 1022,
  431. /** 1023: 240 × 424, frame rate 15 fps, bitrate 220 Kbps. */
  432. VIDEO_PROFILE_PORTRAIT_240P_4 = 1023,
  433. /** 1030: 360 × 640, frame rate 15 fps, bitrate 400 Kbps. */
  434. VIDEO_PROFILE_PORTRAIT_360P = 1030,
  435. /** 1032: 360 × 360, frame rate 15 fps, bitrate 260 Kbps. */
  436. VIDEO_PROFILE_PORTRAIT_360P_3 = 1032,
  437. /** 1033: 360 × 640, frame rate 30 fps, bitrate 600 Kbps. */
  438. VIDEO_PROFILE_PORTRAIT_360P_4 = 1033,
  439. /** 1035: 360 × 360, frame rate 30 fps, bitrate 400 Kbps. */
  440. VIDEO_PROFILE_PORTRAIT_360P_6 = 1035,
  441. /** 1036: 360 × 480, frame rate 15 fps, bitrate 320 Kbps. */
  442. VIDEO_PROFILE_PORTRAIT_360P_7 = 1036,
  443. /** 1037: 360 × 480, frame rate 30 fps, bitrate 490 Kbps. */
  444. VIDEO_PROFILE_PORTRAIT_360P_8 = 1037,
  445. /** 1038: 360 × 640, frame rate 15 fps, bitrate 800 Kbps.
  446. @note Live broadcast profile only.
  447. */
  448. VIDEO_PROFILE_PORTRAIT_360P_9 = 1038,
  449. /** 1039: 360 × 640, frame rate 24 fps, bitrate 800 Kbps.
  450. @note Live broadcast profile only.
  451. */
  452. VIDEO_PROFILE_PORTRAIT_360P_10 = 1039,
  453. /** 1100: 360 × 640, frame rate 24 fps, bitrate 1000 Kbps.
  454. @note Live broadcast profile only.
  455. */
  456. VIDEO_PROFILE_PORTRAIT_360P_11 = 1100,
  457. /** 1040: 480 × 640, frame rate 15 fps, bitrate 500 Kbps. */
  458. VIDEO_PROFILE_PORTRAIT_480P = 1040,
  459. /** 1042: 480 × 480, frame rate 15 fps, bitrate 400 Kbps. */
  460. VIDEO_PROFILE_PORTRAIT_480P_3 = 1042,
  461. /** 1043: 480 × 640, frame rate 30 fps, bitrate 750 Kbps. */
  462. VIDEO_PROFILE_PORTRAIT_480P_4 = 1043,
  463. /** 1045: 480 × 480, frame rate 30 fps, bitrate 600 Kbps. */
  464. VIDEO_PROFILE_PORTRAIT_480P_6 = 1045,
  465. /** 1047: 480 × 848, frame rate 15 fps, bitrate 610 Kbps. */
  466. VIDEO_PROFILE_PORTRAIT_480P_8 = 1047,
  467. /** 1048: 480 × 848, frame rate 30 fps, bitrate 930 Kbps. */
  468. VIDEO_PROFILE_PORTRAIT_480P_9 = 1048,
  469. /** 1049: 480 × 640, frame rate 10 fps, bitrate 400 Kbps. */
  470. VIDEO_PROFILE_PORTRAIT_480P_10 = 1049,
  471. /** 1050: 720 × 1280, frame rate 15 fps, bitrate 1130 Kbps. */
  472. VIDEO_PROFILE_PORTRAIT_720P = 1050,
  473. /** 1052: 720 × 1280, frame rate 30 fps, bitrate 1710 Kbps. */
  474. VIDEO_PROFILE_PORTRAIT_720P_3 = 1052,
  475. /** 1054: 720 × 960, frame rate 15 fps, bitrate 910 Kbps. */
  476. VIDEO_PROFILE_PORTRAIT_720P_5 = 1054,
  477. /** 1055: 720 × 960, frame rate 30 fps, bitrate 1380 Kbps. */
  478. VIDEO_PROFILE_PORTRAIT_720P_6 = 1055,
  479. /** 1060: 1080 × 1920, frame rate 15 fps, bitrate 2080 Kbps. */
  480. VIDEO_PROFILE_PORTRAIT_1080P = 1060,
  481. /** 1062: 1080 × 1920, frame rate 30 fps, bitrate 3150 Kbps. */
  482. VIDEO_PROFILE_PORTRAIT_1080P_3 = 1062,
  483. /** 1064: 1080 × 1920, frame rate 60 fps, bitrate 4780 Kbps. */
  484. VIDEO_PROFILE_PORTRAIT_1080P_5 = 1064,
  485. /** 1066: 1440 × 2560, frame rate 30 fps, bitrate 4850 Kbps. */
  486. VIDEO_PROFILE_PORTRAIT_1440P = 1066,
  487. /** 1067: 1440 × 2560, frame rate 60 fps, bitrate 6500 Kbps. */
  488. VIDEO_PROFILE_PORTRAIT_1440P_2 = 1067,
  489. /** 1070: 2160 × 3840, frame rate 30 fps, bitrate 6500 Kbps. */
  490. VIDEO_PROFILE_PORTRAIT_4K = 1070,
  491. /** 1072: 2160 × 3840, frame rate 60 fps, bitrate 6500 Kbps. */
  492. VIDEO_PROFILE_PORTRAIT_4K_3 = 1072,
  493. /** Default 640 × 360, frame rate 15 fps, bitrate 400 Kbps. */
  494. VIDEO_PROFILE_DEFAULT = VIDEO_PROFILE_LANDSCAPE_360P,
  495. };
  496. /** Audio profiles.
  497. Sets the sample rate, bitrate, encoding mode, and the number of channels:*/
  498. enum AUDIO_PROFILE_TYPE // sample rate, bit rate, mono/stereo, speech/music codec
  499. {
  500. /**
  501. 0: Default audio profile.
  502. - In the Communication profile, the default value is #AUDIO_PROFILE_SPEECH_STANDARD;
  503. - In the Live-broadcast profile, the default value is #AUDIO_PROFILE_MUSIC_STANDARD.
  504. */
  505. AUDIO_PROFILE_DEFAULT = 0, // use default settings
  506. /**
  507. 1: A sample rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps.
  508. */
  509. AUDIO_PROFILE_SPEECH_STANDARD = 1, // 32Khz, 18Kbps, mono, speech
  510. /**
  511. 2: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 48 Kbps.
  512. */
  513. AUDIO_PROFILE_MUSIC_STANDARD = 2, // 48Khz, 48Kbps, mono, music
  514. /**
  515. 3: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 56 Kbps.
  516. */
  517. AUDIO_PROFILE_MUSIC_STANDARD_STEREO = 3, // 48Khz, 56Kbps, stereo, music
  518. /**
  519. 4: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 128 Kbps.
  520. */
  521. AUDIO_PROFILE_MUSIC_HIGH_QUALITY = 4, // 48Khz, 128Kbps, mono, music
  522. /**
  523. 5: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 192 Kbps.
  524. */
  525. AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO = 5, // 48Khz, 192Kbps, stereo, music
  526. /**
  527. 6: A sample rate of 16 kHz, audio encoding, mono, and Acoustic Echo Cancellation (AES) enabled.
  528. */
  529. AUDIO_PROFILE_IOT = 6,
  530. AUDIO_PROFILE_NUM = 7,
  531. };
  532. /** Audio application scenarios.
  533. */
  534. enum AUDIO_SCENARIO_TYPE // set a suitable scenario for your app type
  535. {
  536. /** 0: Default. */
  537. AUDIO_SCENARIO_DEFAULT = 0,
  538. /** 1: Entertainment scenario, supporting voice during gameplay. */
  539. AUDIO_SCENARIO_CHATROOM_ENTERTAINMENT = 1,
  540. /** 2: Education scenario, prioritizing smoothness and stability. */
  541. AUDIO_SCENARIO_EDUCATION = 2,
  542. /** 3: Live gaming scenario, enabling the gaming audio effects in the speaker mode in a live broadcast scenario. Choose this scenario for high-fidelity music playback. */
  543. AUDIO_SCENARIO_GAME_STREAMING = 3,
  544. /** 4: Showroom scenario, optimizing the audio quality with external professional equipment. */
  545. AUDIO_SCENARIO_SHOWROOM = 4,
  546. /** 5: Gaming scenario. */
  547. AUDIO_SCENARIO_CHATROOM_GAMING = 5,
  548. /** 6: Applicable to the IoT scenario. */
  549. AUDIO_SCENARIO_IOT = 6,
  550. AUDIO_SCENARIO_NUM = 7,
  551. };
  552. /** Channel profiles.
  553. */
  554. enum CHANNEL_PROFILE_TYPE
  555. {
  556. /** 0: Communication.
  557. This is used in one-on-one calls or group calls, where all users in the channel can talk freely.
  558. */
  559. CHANNEL_PROFILE_COMMUNICATION = 0,
  560. /** 1: Live Broadcast.
  561. Host and audience roles that can be set by calling the \ref IRtcEngine::setClientRole "setClientRole" method. The host sends and receives voice, while the audience receives voice only with the sending function disabled.
  562. */
  563. CHANNEL_PROFILE_LIVE_BROADCASTING = 1,
  564. /** 2: Gaming.
  565. @note This profile applies to the Agora Gaming SDK only.
  566. Any user in the channel can talk freely. This mode uses the codec with low-power consumption and low bitrate by default.
  567. */
  568. CHANNEL_PROFILE_GAME = 2,
  569. };
  570. /** Client roles in a live broadcast. */
  571. enum CLIENT_ROLE_TYPE
  572. {
  573. /** 1: Host */
  574. CLIENT_ROLE_BROADCASTER = 1,
  575. /** 2: Audience */
  576. CLIENT_ROLE_AUDIENCE = 2,
  577. };
  578. /** Reasons for a user being offline. */
  579. enum USER_OFFLINE_REASON_TYPE
  580. {
  581. /** 0: The user quits the call. */
  582. USER_OFFLINE_QUIT = 0,
  583. /** 1: The SDK times out and the user drops offline because no data packet is received within a certain period of time. If the user quits the call and the message is not passed to the SDK (due to an unreliable channel), the SDK assumes the user dropped offline. */
  584. USER_OFFLINE_DROPPED = 1,
  585. /** 2: (Live broadcast only.) The client role switched from the host to the audience. */
  586. USER_OFFLINE_BECOME_AUDIENCE = 2,
  587. };
  588. /**
  589. States of the RTMP streaming.
  590. */
  591. enum RTMP_STREAM_PUBLISH_STATE
  592. {
  593. /** The RTMP streaming has not started or has ended. This state is also triggered after you remove an RTMP address from the CDN by calling removePublishStreamUrl.
  594. */
  595. RTMP_STREAM_PUBLISH_STATE_IDLE = 0,
  596. /** The SDK is connecting to Agora's streaming server and the RTMP server. This state is triggered after you call the \ref IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" method.
  597. */
  598. RTMP_STREAM_PUBLISH_STATE_CONNECTING = 1,
  599. /** The RTMP streaming publishes. The SDK successfully publishes the RTMP streaming and returns this state.
  600. */
  601. RTMP_STREAM_PUBLISH_STATE_RUNNING = 2,
  602. /** The RTMP streaming is recovering. When exceptions occur to the CDN, or the streaming is interrupted, the SDK tries to resume RTMP streaming and returns this state.
  603. - If the SDK successfully resumes the streaming, #RTMP_STREAM_PUBLISH_STATE_RUNNING (2) returns.
  604. - If the streaming does not resume within 60 seconds or server errors occur, #RTMP_STREAM_PUBLISH_STATE_FAILURE (4) returns. You can also reconnect to the server by calling the \ref IRtcEngine::removePublishStreamUrl "removePublishStreamUrl" and \ref IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" methods.
  605. */
  606. RTMP_STREAM_PUBLISH_STATE_RECOVERING = 3,
  607. /** The RTMP streaming fails. See the errCode parameter for the detailed error information. You can also call the \ref IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" method to publish the RTMP streaming again.
  608. */
  609. RTMP_STREAM_PUBLISH_STATE_FAILURE = 4,
  610. };
  611. /**
  612. Error codes of the RTMP streaming.
  613. */
  614. enum RTMP_STREAM_PUBLISH_ERROR
  615. {
  616. /** The RTMP streaming publishes successfully. */
  617. RTMP_STREAM_PUBLISH_ERROR_OK = 0,
  618. /** Invalid argument used. If, for example, you do not call the \ref IRtcEngine::setLiveTranscoding "setLiveTranscoding" method to configure the LiveTranscoding parameters before calling the addPublishStreamUrl method, the SDK returns this error. Check whether you set the parameters in the *setLiveTranscoding* method properly. */
  619. RTMP_STREAM_PUBLISH_ERROR_INVALID_ARGUMENT = 1,
  620. /** The RTMP streaming is encrypted and cannot be published. */
  621. RTMP_STREAM_PUBLISH_ERROR_ENCRYPTED_STREAM_NOT_ALLOWED = 2,
  622. /** Timeout for the RTMP streaming. Call the \ref IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" method to publish the streaming again. */
  623. RTMP_STREAM_PUBLISH_ERROR_CONNECTION_TIMEOUT = 3,
  624. /** An error occurs in Agora's streaming server. Call the addPublishStreamUrl method to publish the streaming again. */
  625. RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR = 4,
  626. /** An error occurs in the RTMP server. */
  627. RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR = 5,
  628. /** The RTMP streaming publishes too frequently. */
  629. RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN = 6,
  630. /** The host publishes more than 10 URLs. Delete the unnecessary URLs before adding new ones. */
  631. RTMP_STREAM_PUBLISH_ERROR_REACH_LIMIT = 7,
  632. /** The host manipulates other hosts' URLs. Check your app logic. */
  633. RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED = 8,
  634. /** Agora's server fails to find the RTMP streaming. */
  635. RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND = 9,
  636. /** The format of the RTMP streaming URL is not supported. Check whether the URL format is correct. */
  637. RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED = 10,
  638. };
  639. /** States of importing an external video stream in a live broadcast. */
  640. enum INJECT_STREAM_STATUS
  641. {
  642. /** 0: The external video stream imported successfully. */
  643. INJECT_STREAM_STATUS_START_SUCCESS = 0,
  644. /** 1: The external video stream already exists. */
  645. INJECT_STREAM_STATUS_START_ALREADY_EXISTS = 1,
  646. /** 2: The external video stream to be imported is unauthorized. */
  647. INJECT_STREAM_STATUS_START_UNAUTHORIZED = 2,
  648. /** 3: Import external video stream timeout. */
  649. INJECT_STREAM_STATUS_START_TIMEDOUT = 3,
  650. /** 4: Import external video stream failed. */
  651. INJECT_STREAM_STATUS_START_FAILED = 4,
  652. /** 5: The external video stream stopped importing successfully. */
  653. INJECT_STREAM_STATUS_STOP_SUCCESS = 5,
  654. /** 6: No external video stream is found. */
  655. INJECT_STREAM_STATUS_STOP_NOT_FOUND = 6,
  656. /** 7: The external video stream to be stopped importing is unauthorized. */
  657. INJECT_STREAM_STATUS_STOP_UNAUTHORIZED = 7,
  658. /** 8: Stop importing external video stream timeout. */
  659. INJECT_STREAM_STATUS_STOP_TIMEDOUT = 8,
  660. /** 9: Stop importing external video stream failed. */
  661. INJECT_STREAM_STATUS_STOP_FAILED = 9,
  662. /** 10: The external video stream is corrupted. */
  663. INJECT_STREAM_STATUS_BROKEN = 10,
  664. };
  665. /** Remote video stream types. */
  666. enum REMOTE_VIDEO_STREAM_TYPE
  667. {
  668. /** 0: High-stream video. */
  669. REMOTE_VIDEO_STREAM_HIGH = 0,
  670. /** 1: Low-stream video. */
  671. REMOTE_VIDEO_STREAM_LOW = 1,
  672. };
  673. /** Use modes of the \ref media::IAudioFrameObserver::onRecordAudioFrame "onRecordAudioFrame" callback. */
  674. enum RAW_AUDIO_FRAME_OP_MODE_TYPE
  675. {
  676. /** 0: Read-only mode: Users only read the \ref agora::media::IAudioFrameObserver::AudioFrame "AudioFrame" data without modifying anything. For example, when users acquire the data with the Agora SDK, then push the RTMP streams. */
  677. RAW_AUDIO_FRAME_OP_MODE_READ_ONLY = 0,
  678. /** 1: Write-only mode: Users replace the \ref agora::media::IAudioFrameObserver::AudioFrame "AudioFrame" data with their own data and pass the data to the SDK for encoding. For example, when users acquire the data. */
  679. RAW_AUDIO_FRAME_OP_MODE_WRITE_ONLY = 1,
  680. /** 2: Read and write mode: Users read the data from \ref agora::media::IAudioFrameObserver::AudioFrame "AudioFrame", modify it, and then play it. For example, when users have their own sound-effect processing module and perform some voice pre-processing, such as a voice change. */
  681. RAW_AUDIO_FRAME_OP_MODE_READ_WRITE = 2,
  682. };
  683. /** Audio-sample rates. */
  684. enum AUDIO_SAMPLE_RATE_TYPE
  685. {
  686. /** 32000: 32 kHz */
  687. AUDIO_SAMPLE_RATE_32000 = 32000,
  688. /** 44100: 44.1 kHz */
  689. AUDIO_SAMPLE_RATE_44100 = 44100,
  690. /** 48000: 48 kHz */
  691. AUDIO_SAMPLE_RATE_48000 = 48000,
  692. };
  693. /** Video codec profile types. */
  694. enum VIDEO_CODEC_PROFILE_TYPE
  695. { /** 66: Baseline video codec profile. Generally used in video calls on mobile phones. */
  696. VIDEO_CODEC_PROFILE_BASELINE = 66,
  697. /** 77: Main video codec profile. Generally used in mainstream electronics such as MP4 players, portable video players, PSP, and iPads. */
  698. VIDEO_CODEC_PROFILE_MAIN = 77,
  699. /** 100: (Default) High video codec profile. Generally used in high-resolution broadcasts or television. */
  700. VIDEO_CODEC_PROFILE_HIGH = 100,
  701. };
  702. /** Video codec types */
  703. enum VIDEO_CODEC_TYPE {
  704. /** Standard VP8 */
  705. VIDEO_CODEC_VP8 = 1,
  706. /** Standard H264 */
  707. VIDEO_CODEC_H264 = 2,
  708. /** Enhanced VP8 */
  709. VIDEO_CODEC_EVP = 3,
  710. /** Enhanced H264 */
  711. VIDEO_CODEC_E264 = 4,
  712. };
  713. /** Audio equalization band frequencies. */
  714. enum AUDIO_EQUALIZATION_BAND_FREQUENCY
  715. {
  716. /** 0: 31 Hz */
  717. AUDIO_EQUALIZATION_BAND_31 = 0,
  718. /** 1: 62 Hz */
  719. AUDIO_EQUALIZATION_BAND_62 = 1,
  720. /** 2: 125 Hz */
  721. AUDIO_EQUALIZATION_BAND_125 = 2,
  722. /** 3: 250 Hz */
  723. AUDIO_EQUALIZATION_BAND_250 = 3,
  724. /** 4: 500 Hz */
  725. AUDIO_EQUALIZATION_BAND_500 = 4,
  726. /** 5: 1 kHz */
  727. AUDIO_EQUALIZATION_BAND_1K = 5,
  728. /** 6: 2 kHz */
  729. AUDIO_EQUALIZATION_BAND_2K = 6,
  730. /** 7: 4 kHz */
  731. AUDIO_EQUALIZATION_BAND_4K = 7,
  732. /** 8: 8 kHz */
  733. AUDIO_EQUALIZATION_BAND_8K = 8,
  734. /** 9: 16 kHz */
  735. AUDIO_EQUALIZATION_BAND_16K = 9,
  736. };
  737. /** Audio reverberation types. */
  738. enum AUDIO_REVERB_TYPE
  739. {
  740. /** 0: The level of the dry signal (db). The value is between -20 and 10. */
  741. AUDIO_REVERB_DRY_LEVEL = 0, // (dB, [-20,10]), the level of the dry signal
  742. /** 1: The level of the early reflection signal (wet signal) (dB). The value is between -20 and 10. */
  743. AUDIO_REVERB_WET_LEVEL = 1, // (dB, [-20,10]), the level of the early reflection signal (wet signal)
  744. /** 2: The room size of the reflection. The value is between 0 and 100. */
  745. AUDIO_REVERB_ROOM_SIZE = 2, // ([0,100]), the room size of the reflection
  746. /** 3: The length of the initial delay of the wet signal (ms). The value is between 0 and 200. */
  747. AUDIO_REVERB_WET_DELAY = 3, // (ms, [0,200]), the length of the initial delay of the wet signal in ms
  748. /** 4: The reverberation strength. The value is between 0 and 100. */
  749. AUDIO_REVERB_STRENGTH = 4, // ([0,100]), the strength of the reverberation
  750. };
  751. /** Local voice changer options. */
  752. enum VOICE_CHANGER_PRESET {
  753. /** 0: The original voice (no local voice change).
  754. */
  755. VOICE_CHANGER_OFF = 0, //Turn off the voice changer
  756. /** 1: An old man's voice.
  757. */
  758. VOICE_CHANGER_OLDMAN = 1,
  759. /** 2: A little boy's voice.
  760. */
  761. VOICE_CHANGER_BABYBOY = 2,
  762. /** 3: A little girl's voice.
  763. */
  764. VOICE_CHANGER_BABYGIRL = 3,
  765. /** 4: The voice of a growling bear.
  766. */
  767. VOICE_CHANGER_ZHUBAJIE = 4,
  768. /** 5: Ethereal vocal effects.
  769. */
  770. VOICE_CHANGER_ETHEREAL = 5,
  771. /** 6: Hulk's voice.
  772. */
  773. VOICE_CHANGER_HULK = 6
  774. };
  775. /** Local voice reverberation presets. */
  776. enum AUDIO_REVERB_PRESET {
  777. /** 0: The original voice (no local voice reverberation).
  778. */
  779. AUDIO_REVERB_OFF = 0, // Turn off audio reverb
  780. /** 1: Pop music.
  781. */
  782. AUDIO_REVERB_POPULAR = 1,
  783. /** 2: R&B.
  784. */
  785. AUDIO_REVERB_RNB = 2,
  786. /** 3: Rock music.
  787. */
  788. AUDIO_REVERB_ROCK = 3,
  789. /** 4: Hip-hop.
  790. */
  791. AUDIO_REVERB_HIPHOP = 4,
  792. /** 5: Pop concert.
  793. */
  794. AUDIO_REVERB_VOCAL_CONCERT = 5,
  795. /** 6: Karaoke.
  796. */
  797. AUDIO_REVERB_KTV = 6,
  798. /** 7: Recording studio.
  799. */
  800. AUDIO_REVERB_STUDIO = 7
  801. };
  802. /** Audio codec profile types. The default value is LC_ACC. */
  803. enum AUDIO_CODEC_PROFILE_TYPE
  804. {
  805. /** 0: LC-AAC, which is the low-complexity audio codec type. */
  806. AUDIO_CODEC_PROFILE_LC_AAC = 0,
  807. /** 1: HE-AAC, which is the high-efficiency audio codec type. */
  808. AUDIO_CODEC_PROFILE_HE_AAC = 1,
  809. };
  810. /** Remote audio states.
  811. */
  812. enum REMOTE_AUDIO_STATE
  813. {
  814. /** 0: The remote audio is in the default state, probably due to
  815. * #REMOTE_AUDIO_REASON_LOCAL_MUTED (3),
  816. * #REMOTE_AUDIO_REASON_REMOTE_MUTED (5), or
  817. * #REMOTE_AUDIO_REASON_REMOTE_OFFLINE (7).
  818. */
  819. REMOTE_AUDIO_STATE_STOPPED = 0, // Default state, audio is started or remote user disabled/muted audio stream
  820. /** 1: The first remote audio packet is received.
  821. */
  822. REMOTE_AUDIO_STATE_STARTING = 1, // The first audio frame packet has been received
  823. /** 2: The remote audio stream is decoded and plays normally, probably
  824. * due to #REMOTE_AUDIO_REASON_NETWORK_RECOVERY (2),
  825. * #REMOTE_AUDIO_REASON_LOCAL_UNMUTED (4), or
  826. * #REMOTE_AUDIO_REASON_REMOTE_UNMUTED (6).
  827. */
  828. REMOTE_AUDIO_STATE_DECODING = 2, // The first remote audio frame has been decoded or fronzen state ends
  829. /** 3: The remote audio is frozen, probably due to
  830. * #REMOTE_AUDIO_REASON_NETWORK_CONGESTION (1).
  831. */
  832. REMOTE_AUDIO_STATE_FROZEN = 3, // Remote audio is frozen, probably due to network issue
  833. /** 4: The remote audio fails to start, probably due to
  834. * #REMOTE_AUDIO_REASON_INTERNAL (0).
  835. */
  836. REMOTE_AUDIO_STATE_FAILED = 4, // Remote audio play failed
  837. };
  838. /** Remote audio state reasons.
  839. */
  840. enum REMOTE_AUDIO_STATE_REASON
  841. {
  842. /** 0: Internal reasons.
  843. */
  844. REMOTE_AUDIO_REASON_INTERNAL = 0,
  845. /** 1: Network congestion.
  846. */
  847. REMOTE_AUDIO_REASON_NETWORK_CONGESTION = 1,
  848. /** 2: Network recovery.
  849. */
  850. REMOTE_AUDIO_REASON_NETWORK_RECOVERY = 2,
  851. /** 3: The local user stops receiving the remote audio stream or
  852. * disables the audio module.
  853. */
  854. REMOTE_AUDIO_REASON_LOCAL_MUTED = 3,
  855. /** 4: The local user resumes receiving the remote audio stream or
  856. * enables the audio module.
  857. */
  858. REMOTE_AUDIO_REASON_LOCAL_UNMUTED = 4,
  859. /** 5: The remote user stops sending the audio stream or disables the
  860. * audio module.
  861. */
  862. REMOTE_AUDIO_REASON_REMOTE_MUTED = 5,
  863. /** 6: The remote user resumes sending the audio stream or enables the
  864. * audio module.
  865. */
  866. REMOTE_AUDIO_REASON_REMOTE_UNMUTED = 6,
  867. /** 7: The remote user leaves the channel.
  868. */
  869. REMOTE_AUDIO_REASON_REMOTE_OFFLINE = 7,
  870. };
  871. /** Remote video states. */
  872. // enum REMOTE_VIDEO_STATE
  873. // {
  874. // // REMOTE_VIDEO_STATE_STOPPED is not used at this version. Ignore this value.
  875. // // REMOTE_VIDEO_STATE_STOPPED = 0, // Default state, video is started or remote user disabled/muted video stream
  876. // /** 1: The remote video is playing. */
  877. // REMOTE_VIDEO_STATE_RUNNING = 1, // Running state, remote video can be displayed normally
  878. // /** 2: The remote video is frozen. */
  879. // REMOTE_VIDEO_STATE_FROZEN = 2, // Remote video is frozen, probably due to network issue.
  880. // };
  881. /** The state of the remote video. */
  882. enum REMOTE_VIDEO_STATE {
  883. /** 0: The remote video is in the default state, probably due to #REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED (3), #REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED (5), or #REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE (7).
  884. */
  885. REMOTE_VIDEO_STATE_STOPPED = 0,
  886. /** 1: The first remote video packet is received.
  887. */
  888. REMOTE_VIDEO_STATE_STARTING = 1,
  889. /** 2: The remote video stream is decoded and plays normally, probably due to #REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY (2), #REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED (4), #REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED (6), or #REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY (9).
  890. */
  891. REMOTE_VIDEO_STATE_DECODING = 2,
  892. /** 3: The remote video is frozen, probably due to #REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION (1) or #REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK (8).
  893. */
  894. REMOTE_VIDEO_STATE_FROZEN = 3,
  895. /** 4: The remote video fails to start, probably due to #REMOTE_VIDEO_STATE_REASON_INTERNAL (0).
  896. */
  897. REMOTE_VIDEO_STATE_FAILED = 4
  898. };
  899. /** The reason of the remote video state change. */
  900. enum REMOTE_VIDEO_STATE_REASON {
  901. /** 0: Internal reasons.
  902. */
  903. REMOTE_VIDEO_STATE_REASON_INTERNAL = 0,
  904. /** 1: Network congestion.
  905. */
  906. REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION = 1,
  907. /** 2: Network recovery.
  908. */
  909. REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY = 2,
  910. /** 3: The local user stops receiving the remote video stream or disables the video module.
  911. */
  912. REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED = 3,
  913. /** 4: The local user resumes receiving the remote video stream or enables the video module.
  914. */
  915. REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED = 4,
  916. /** 5: The remote user stops sending the video stream or disables the video module.
  917. */
  918. REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED = 5,
  919. /** 6: The remote user resumes sending the video stream or enables the video module.
  920. */
  921. REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED = 6,
  922. /** 7: The remote user leaves the channel.
  923. */
  924. REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE = 7,
  925. /** 8: The remote media stream falls back to the audio-only stream due to poor network conditions.
  926. */
  927. REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK = 8,
  928. /** 9: The remote media stream switches back to the video stream after the network conditions improve.
  929. */
  930. REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY = 9
  931. };
  932. /** Video frame rates. */
  933. enum FRAME_RATE
  934. {
  935. /** 1: 1 fps */
  936. FRAME_RATE_FPS_1 = 1,
  937. /** 7: 7 fps */
  938. FRAME_RATE_FPS_7 = 7,
  939. /** 10: 10 fps */
  940. FRAME_RATE_FPS_10 = 10,
  941. /** 15: 15 fps */
  942. FRAME_RATE_FPS_15 = 15,
  943. /** 24: 24 fps */
  944. FRAME_RATE_FPS_24 = 24,
  945. /** 30: 30 fps */
  946. FRAME_RATE_FPS_30 = 30,
  947. /** 60: 60 fps (Windows and macOS only) */
  948. FRAME_RATE_FPS_60 = 60,
  949. };
  950. /** Video output orientation modes.
  951. */
  952. enum ORIENTATION_MODE {
  953. /** 0: (Default) Adaptive mode.
  954. The video encoder adapts to the orientation mode of the video input device.
  955. - If the width of the captured video from the SDK is greater than the height, the encoder sends the video in landscape mode. The encoder also sends the rotational information of the video, and the receiver uses the rotational information to rotate the received video.
  956. - When you use a custom video source, the output video from the encoder inherits the orientation of the original video. If the original video is in portrait mode, the output video from the encoder is also in portrait mode. The encoder also sends the rotational information of the video to the receiver.
  957. */
  958. ORIENTATION_MODE_ADAPTIVE = 0,
  959. /** 1: Landscape mode.
  960. The video encoder always sends the video in landscape mode. The video encoder rotates the original video before sending it and the rotational infomation is 0. This mode applies to scenarios involving CDN live streaming.
  961. */
  962. ORIENTATION_MODE_FIXED_LANDSCAPE = 1,
  963. /** 2: Portrait mode.
  964. The video encoder always sends the video in portrait mode. The video encoder rotates the original video before sending it and the rotational infomation is 0. This mode applies to scenarios involving CDN live streaming.
  965. */
  966. ORIENTATION_MODE_FIXED_PORTRAIT = 2,
  967. };
  968. /** Video degradation preferences when the bandwidth is a constraint. */
  969. enum DEGRADATION_PREFERENCE {
  970. /** 0: (Default) Degrade the frame rate in order to maintain the video quality. */
  971. MAINTAIN_QUALITY = 0,
  972. /** 1: Degrade the video quality in order to maintain the frame rate. */
  973. MAINTAIN_FRAMERATE = 1,
  974. /** 2: (For future use) Maintain a balance between the frame rate and video quality. */
  975. MAINTAIN_BALANCED = 2,
  976. };
  977. /** Stream fallback options. */
  978. enum STREAM_FALLBACK_OPTIONS
  979. {
  980. /** 0: No fallback behavior for the local/remote video stream when the uplink/downlink network conditions are poor. The quality of the stream is not guaranteed. */
  981. STREAM_FALLBACK_OPTION_DISABLED = 0,
  982. /** 1: Under poor downlink network conditions, the remote video stream, to which you subscribe, falls back to the low-stream (low resolution and low bitrate) video. You can set this option only in the \ref IRtcEngine::setRemoteSubscribeFallbackOption "setRemoteSubscribeFallbackOption" method. Nothing happens when you set this in the \ref IRtcEngine::setLocalPublishFallbackOption "setLocalPublishFallbackOption" method. */
  983. STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW = 1,
  984. /** 2: Under poor uplink network conditions, the locally published video stream falls back to audio only.
  985. Under poor downlink network conditions, the remote video stream, to which you subscribe, first falls back to the low-stream (low resolution and low bitrate) video; and then to an audio-only stream if the network conditions worsen.*/
  986. STREAM_FALLBACK_OPTION_AUDIO_ONLY = 2,
  987. };
  988. /** Camera capturer configuration.
  989. */
  990. enum CAPTURER_OUTPUT_PREFERENCE
  991. {
  992. /** 0: (Default) self-adapts the camera output parameters to the system performance and network conditions to balance CPU consumption and video preview quality.
  993. */
  994. CAPTURER_OUTPUT_PREFERENCE_AUTO = 0,
  995. /** 2: Prioritizes the system performance. The SDK chooses the dimension and frame rate of the local camera capture closest to those set by \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration".
  996. */
  997. CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE = 1,
  998. /** 2: Prioritizes the local preview quality. The SDK chooses higher camera output parameters to improve the local video preview quality. This option requires extra CPU and RAM usage for video pre-processing.
  999. */
  1000. CAPTURER_OUTPUT_PREFERENCE_PREVIEW = 2,
  1001. };
  1002. /** The priority of the remote user.
  1003. */
  1004. enum PRIORITY_TYPE
  1005. {
  1006. /** 50: The user's priority is high.
  1007. */
  1008. PRIORITY_HIGH = 50,
  1009. /** 100: (Default) The user's priority is normal.
  1010. */
  1011. PRIORITY_NORMAL = 100,
  1012. };
  1013. /** Connection states. */
  1014. enum CONNECTION_STATE_TYPE
  1015. {
  1016. /** 1: The SDK is disconnected from Agora's edge server.
  1017. - This is the initial state before calling the \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method.
  1018. - The SDK also enters this state when the application calls the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method.
  1019. */
  1020. CONNECTION_STATE_DISCONNECTED = 1,
  1021. /** 2: The SDK is connecting to Agora's edge server.
  1022. - When the application calls the \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method, the SDK starts to establish a connection to the specified channel, triggers the \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback, and switches to the #CONNECTION_STATE_CONNECTING state.
  1023. - When the SDK successfully joins the channel, it triggers the \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback and switches to the #CONNECTION_STATE_CONNECTED state.
  1024. - After the SDK joins the channel and when it finishes initializing the media engine, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" callback.
  1025. */
  1026. CONNECTION_STATE_CONNECTING = 2,
  1027. /** 3: The SDK is connected to Agora's edge server and has joined a channel. You can now publish or subscribe to a media stream in the channel.
  1028. If the connection to the channel is lost because, for example, if the network is down or switched, the SDK automatically tries to reconnect and triggers:
  1029. - The \ref agora::rtc::IRtcEngineEventHandler::onConnectionInterrupted "onConnectionInterrupted" callback (deprecated).
  1030. - The \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback and switches to the #CONNECTION_STATE_RECONNECTING state.
  1031. */
  1032. CONNECTION_STATE_CONNECTED = 3,
  1033. /** 4: The SDK keeps rejoining the channel after being disconnected from a joined channel because of network issues.
  1034. - If the SDK cannot rejoin the channel within 10 seconds after being disconnected from Agora's edge server, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onConnectionLost "onConnectionLost" callback, stays in the #CONNECTION_STATE_RECONNECTING state, and keeps rejoining the channel.
  1035. - If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback, switches to the #CONNECTION_STATE_FAILED state, and stops rejoining the channel.
  1036. */
  1037. CONNECTION_STATE_RECONNECTING = 4,
  1038. /** 5: The SDK fails to connect to Agora's edge server or join the channel.
  1039. You must call the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method to leave this state, and call the \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method again to rejoin the channel.
  1040. If the SDK is banned from joining the channel by Agora's edge server (through the RESTful API), the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onConnectionBanned "onConnectionBanned" (deprecated) and \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callbacks.
  1041. */
  1042. CONNECTION_STATE_FAILED = 5,
  1043. };
  1044. /** Reasons for a connection state change. */
  1045. enum CONNECTION_CHANGED_REASON_TYPE
  1046. {
  1047. /** 0: The SDK is connecting to Agora's edge server. */
  1048. CONNECTION_CHANGED_CONNECTING = 0,
  1049. /** 1: The SDK has joined the channel successfully. */
  1050. CONNECTION_CHANGED_JOIN_SUCCESS = 1,
  1051. /** 2: The connection between the SDK and Agora's edge server is interrupted. */
  1052. CONNECTION_CHANGED_INTERRUPTED = 2,
  1053. /** 3: The connection between the SDK and Agora's edge server is banned by Agora's edge server. */
  1054. CONNECTION_CHANGED_BANNED_BY_SERVER = 3,
  1055. /** 4: The SDK fails to join the channel for more than 20 minutes and stops reconnecting to the channel. */
  1056. CONNECTION_CHANGED_JOIN_FAILED = 4,
  1057. /** 5: The SDK has left the channel. */
  1058. CONNECTION_CHANGED_LEAVE_CHANNEL = 5,
  1059. /** 6: The connection failed since Appid is not valid. */
  1060. CONNECTION_CHANGED_INVALID_APP_ID = 6,
  1061. /** 7: The connection failed since channel name is not valid. */
  1062. CONNECTION_CHANGED_INVALID_CHANNEL_NAME = 7,
  1063. /** 8: The connection failed since token is not valid, possibly because:
  1064. - The App Certificate for the project is enabled in Dashboard, but you do not use Token when joining the channel. If you enable the App Certificate, you must use a token to join the channel.
  1065. - The uid that you specify in the \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method is different from the uid that you pass for generating the token.
  1066. */
  1067. CONNECTION_CHANGED_INVALID_TOKEN = 8,
  1068. /** 9: The connection failed since token is expired. */
  1069. CONNECTION_CHANGED_TOKEN_EXPIRED = 9,
  1070. /** 10: The connection is rejected by server. */
  1071. CONNECTION_CHANGED_REJECTED_BY_SERVER = 10,
  1072. /** 11: The connection changed to reconnecting since SDK has set a proxy server. */
  1073. CONNECTION_CHANGED_SETTING_PROXY_SERVER = 11,
  1074. /** 12: When SDK is in connection failed, the renew token operation will make it connecting. */
  1075. CONNECTION_CHANGED_RENEW_TOKEN = 12,
  1076. /** 13: The IP Address of SDK client has changed. i.e., Network type or IP/Port changed by network operator might change client IP address. */
  1077. CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED = 13,
  1078. /** 14: Timeout for the keep-alive of the connection between the SDK and Agora's edge server. The connection state changes to CONNECTION_STATE_RECONNECTING(4). */
  1079. CONNECTION_CHANGED_KEEP_ALIVE_TIMEOUT = 14,
  1080. };
  1081. /** Network type. */
  1082. enum NETWORK_TYPE
  1083. {
  1084. /** -1: The network type is unknown. */
  1085. NETWORK_TYPE_UNKNOWN = -1,
  1086. /** 0: The SDK disconnects from the network. */
  1087. NETWORK_TYPE_DISCONNECTED = 0,
  1088. /** 1: The network type is LAN. */
  1089. NETWORK_TYPE_LAN = 1,
  1090. /** 2: The network type is Wi-Fi(including hotspots). */
  1091. NETWORK_TYPE_WIFI = 2,
  1092. /** 3: The network type is mobile 2G. */
  1093. NETWORK_TYPE_MOBILE_2G = 3,
  1094. /** 4: The network type is mobile 3G. */
  1095. NETWORK_TYPE_MOBILE_3G = 4,
  1096. /** 5: The network type is mobile 4G. */
  1097. NETWORK_TYPE_MOBILE_4G = 5,
  1098. };
  1099. /** States of the last-mile network probe test. */
  1100. enum LASTMILE_PROBE_RESULT_STATE {
  1101. /** 1: The last-mile network probe test is complete. */
  1102. LASTMILE_PROBE_RESULT_COMPLETE = 1,
  1103. /** 2: The last-mile network probe test is incomplete and the bandwidth estimation is not available, probably due to limited test resources. */
  1104. LASTMILE_PROBE_RESULT_INCOMPLETE_NO_BWE = 2,
  1105. /** 3: The last-mile network probe test is not carried out, probably due to poor network conditions. */
  1106. LASTMILE_PROBE_RESULT_UNAVAILABLE = 3
  1107. };
  1108. /** Audio output routing. */
  1109. enum AUDIO_ROUTE_TYPE {
  1110. /** Default.
  1111. */
  1112. AUDIO_ROUTE_DEFAULT = -1,
  1113. /** Headset.
  1114. */
  1115. AUDIO_ROUTE_HEADSET = 0,
  1116. /** Earpiece.
  1117. */
  1118. AUDIO_ROUTE_EARPIECE = 1,
  1119. /** Headset with no microphone.
  1120. */
  1121. AUDIO_ROUTE_HEADSET_NO_MIC = 2,
  1122. /** Speakerphone.
  1123. */
  1124. AUDIO_ROUTE_SPEAKERPHONE = 3,
  1125. /** Loudspeaker.
  1126. */
  1127. AUDIO_ROUTE_LOUDSPEAKER = 4,
  1128. /** Bluetooth headset.
  1129. */
  1130. AUDIO_ROUTE_BLUETOOTH = 5
  1131. };
  1132. #if (defined(__APPLE__) && TARGET_OS_IOS)
  1133. /** Audio session restriction. */
  1134. enum AUDIO_SESSION_OPERATION_RESTRICTION {
  1135. /** No restriction, the SDK has full control of the audio session operations. */
  1136. AUDIO_SESSION_OPERATION_RESTRICTION_NONE = 0,
  1137. /** The SDK does not change the audio session category. */
  1138. AUDIO_SESSION_OPERATION_RESTRICTION_SET_CATEGORY = 1,
  1139. /** The SDK does not change any setting of the audio session (category, mode, categoryOptions). */
  1140. AUDIO_SESSION_OPERATION_RESTRICTION_CONFIGURE_SESSION = 1 << 1,
  1141. /** The SDK keeps the audio session active when leaving a channel. */
  1142. AUDIO_SESSION_OPERATION_RESTRICTION_DEACTIVATE_SESSION = 1 << 2,
  1143. /** The SDK does not configure the audio session anymore. */
  1144. AUDIO_SESSION_OPERATION_RESTRICTION_ALL = 1 << 7,
  1145. };
  1146. #endif
  1147. /** The uplink or downlink last-mile network probe test result. */
  1148. struct LastmileProbeOneWayResult {
  1149. /** The packet loss rate (%). */
  1150. unsigned int packetLossRate;
  1151. /** The network jitter (ms). */
  1152. unsigned int jitter;
  1153. /* The estimated available bandwidth (Kbps). */
  1154. unsigned int availableBandwidth;
  1155. };
  1156. /** The uplink and downlink last-mile network probe test result. */
  1157. struct LastmileProbeResult{
  1158. /** The state of the probe test. */
  1159. LASTMILE_PROBE_RESULT_STATE state;
  1160. /** The uplink last-mile network probe test result. */
  1161. LastmileProbeOneWayResult uplinkReport;
  1162. /** The downlink last-mile network probe test result. */
  1163. LastmileProbeOneWayResult downlinkReport;
  1164. /** The round-trip delay time (ms). */
  1165. unsigned int rtt;
  1166. };
  1167. /** Configurations of the last-mile network probe test. */
  1168. struct LastmileProbeConfig {
  1169. /** Sets whether or not to test the uplink network. Some users, for example, the audience in a Live-broadcast channel, do not need such a test:
  1170. - true: test.
  1171. - false: do not test. */
  1172. bool probeUplink;
  1173. /** Sets whether or not to test the downlink network:
  1174. - true: test.
  1175. - false: do not test. */
  1176. bool probeDownlink;
  1177. /** The expected maximum sending bitrate (Kbps) of the local user. The value ranges between 100 and 5000. We recommend setting this parameter according to the bitrate value set by \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration". */
  1178. unsigned int expectedUplinkBitrate;
  1179. /** The expected maximum receiving bitrate (Kbps) of the local user. The value ranges between 100 and 5000. */
  1180. unsigned int expectedDownlinkBitrate;
  1181. };
  1182. /** Properties of the audio volume information.
  1183. An array containing the user ID and volume information for each speaker.
  1184. */
  1185. struct AudioVolumeInfo
  1186. {
  1187. /**
  1188. User ID of the speaker. The uid of the local user is 0.
  1189. */
  1190. uid_t uid;
  1191. /** The volume of the speaker. The volume ranges between 0 (lowest volume) and 255 (highest volume).
  1192. */
  1193. unsigned int volume;
  1194. };
  1195. /** Statistics of the channel.
  1196. */
  1197. struct RtcStats
  1198. {
  1199. /**
  1200. Call duration (s), represented by an aggregate value.
  1201. */
  1202. unsigned int duration;
  1203. /**
  1204. Total number of bytes transmitted, represented by an aggregate value.
  1205. */
  1206. unsigned int txBytes;
  1207. /**
  1208. Total number of bytes received, represented by an aggregate value.
  1209. */
  1210. unsigned int rxBytes;
  1211. /** Total number of audio bytes sent (bytes), represented
  1212. * by an aggregate value.
  1213. */
  1214. unsigned int txAudioBytes;
  1215. /** Total number of video bytes sent (bytes), represented
  1216. * by an aggregate value.
  1217. */
  1218. unsigned int txVideoBytes;
  1219. /** Total number of audio bytes received (bytes) before
  1220. * network countermeasures, represented by an aggregate value.
  1221. */
  1222. unsigned int rxAudioBytes;
  1223. /** Total number of video bytes received (bytes),
  1224. * represented by an aggregate value.
  1225. */
  1226. unsigned int rxVideoBytes;
  1227. /**
  1228. Transmission bitrate (Kbps), represented by an instantaneous value.
  1229. */
  1230. unsigned short txKBitRate;
  1231. /**
  1232. Receive bitrate (Kbps), represented by an instantaneous value.
  1233. */
  1234. unsigned short rxKBitRate;
  1235. /**
  1236. Audio receive bitrate (Kbps), represented by an instantaneous value.
  1237. */
  1238. unsigned short rxAudioKBitRate;
  1239. /**
  1240. Audio transmission bitrate (Kbps), represented by an instantaneous value.
  1241. */
  1242. unsigned short txAudioKBitRate;
  1243. /**
  1244. Video receive bitrate (Kbps), represented by an instantaneous value.
  1245. */
  1246. unsigned short rxVideoKBitRate;
  1247. /**
  1248. Video transmission bitrate (Kbps), represented by an instantaneous value.
  1249. */
  1250. unsigned short txVideoKBitRate;
  1251. /** Client-server latency (ms)
  1252. */
  1253. unsigned short lastmileDelay;
  1254. /** The packet loss rate (%) from the local client to Agora's edge server,
  1255. * before network countermeasures.
  1256. */
  1257. unsigned short txPacketLossRate;
  1258. /** The packet loss rate (%) from Agora's edge server to the local client,
  1259. * before network countermeasures.
  1260. */
  1261. unsigned short rxPacketLossRate;
  1262. /** Number of users in the channel.
  1263. - Communication profile: The number of users in the channel.
  1264. - Live broadcast profile:
  1265. - If the local user is an audience: The number of users in the channel = The number of hosts in the channel + 1.
  1266. - If the user is a host: The number of users in the channel = The number of hosts in the channel.
  1267. */
  1268. unsigned int userCount;
  1269. /**
  1270. Application CPU usage (%).
  1271. */
  1272. double cpuAppUsage;
  1273. /**
  1274. System CPU usage (%).
  1275. */
  1276. double cpuTotalUsage;
  1277. RtcStats()
  1278. : duration(0)
  1279. , txBytes(0)
  1280. , rxBytes(0)
  1281. , txAudioBytes(0)
  1282. , txVideoBytes(0)
  1283. , rxAudioBytes(0)
  1284. , rxVideoBytes(0)
  1285. , txKBitRate(0)
  1286. , rxKBitRate(0)
  1287. , rxAudioKBitRate(0)
  1288. , txAudioKBitRate(0)
  1289. , rxVideoKBitRate(0)
  1290. , txVideoKBitRate(0)
  1291. , lastmileDelay(0)
  1292. , txPacketLossRate(0)
  1293. , rxPacketLossRate(0)
  1294. , userCount(0)
  1295. , cpuAppUsage(0)
  1296. , cpuTotalUsage(0) {}
  1297. };
  1298. /** Quality change of the local video in terms of target frame rate and target bit rate since last count.
  1299. */
  1300. enum QUALITY_ADAPT_INDICATION {
  1301. /** The quality of the local video stays the same. */
  1302. ADAPT_NONE = 0,
  1303. /** The quality improves because the network bandwidth increases. */
  1304. ADAPT_UP_BANDWIDTH = 1,
  1305. /** The quality worsens because the network bandwidth decreases. */
  1306. ADAPT_DOWN_BANDWIDTH = 2,
  1307. };
  1308. enum CHANNEL_MEDIA_RELAY_ERROR {
  1309. /** 0: The state is normal.
  1310. */
  1311. RELAY_OK = 0,
  1312. /** 1: An error occurs in the server response.
  1313. */
  1314. RELAY_ERROR_SERVER_ERROR_RESPONSE = 1,
  1315. /** 2: No server response. You can call the
  1316. * \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method to
  1317. * leave the channel.
  1318. */
  1319. RELAY_ERROR_SERVER_NO_RESPONSE = 2,
  1320. /** 3: The SDK fails to access the service, probably due to limited
  1321. * resources of the server.
  1322. */
  1323. RELAY_ERROR_NO_RESOURCE_AVAILABLE = 3,
  1324. /** 4: The server fails to join the source channel.
  1325. */
  1326. RELAY_ERROR_FAILED_JOIN_SRC = 4,
  1327. /** 5: The server fails to join the destination channel.
  1328. */
  1329. RELAY_ERROR_FAILED_JOIN_DEST = 5,
  1330. /** 6: The server fails to receive the data from the source channel.
  1331. */
  1332. RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC = 6,
  1333. /** 7: The source channel fails to transmit data.
  1334. */
  1335. RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST = 7,
  1336. /** 8: The SDK disconnects from the server due to poor network
  1337. * connections. You can call the \ref agora::rtc::IRtcEngine::leaveChannel
  1338. * "leaveChannel" method to leave the channel.
  1339. */
  1340. RELAY_ERROR_SERVER_CONNECTION_LOST = 8,
  1341. /** 9: An internal error occurs in the server.
  1342. */
  1343. RELAY_ERROR_INTERNAL_ERROR = 9,
  1344. /** 10: The token of the source channel has expired.
  1345. */
  1346. RELAY_ERROR_SRC_TOKEN_EXPIRED = 10,
  1347. /** 11: The token of the destination channel has expired.
  1348. */
  1349. RELAY_ERROR_DEST_TOKEN_EXPIRED = 11,
  1350. };
  1351. enum CHANNEL_MEDIA_RELAY_EVENT {
  1352. /** 0: The user disconnects from the server due to poor network
  1353. * connections.
  1354. */
  1355. RELAY_EVENT_NETWORK_DISCONNECTED = 0,
  1356. /** 1: The network reconnects.
  1357. */
  1358. RELAY_EVENT_NETWORK_CONNECTED = 1,
  1359. /** 2: The user joins the source channel.
  1360. */
  1361. RELAY_EVENT_PACKET_JOINED_SRC_CHANNEL = 2,
  1362. /** 3: The user joins the destination channel.
  1363. */
  1364. RELAY_EVENT_PACKET_JOINED_DEST_CHANNEL = 3,
  1365. /** 4: The SDK starts relaying the media stream to the destination channel.
  1366. */
  1367. RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL = 4,
  1368. /** 5: The server receives the video stream from the source channel.
  1369. */
  1370. RELAY_EVENT_PACKET_RECEIVED_VIDEO_FROM_SRC = 5,
  1371. /** 6: The server receives the audio stream from the source channel.
  1372. */
  1373. RELAY_EVENT_PACKET_RECEIVED_AUDIO_FROM_SRC = 6,
  1374. /** 7: The destination channel is updated.
  1375. */
  1376. RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL = 7,
  1377. /** 8: The destination channel update fails due to internal reasons.
  1378. */
  1379. RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_REFUSED = 8,
  1380. /** 9: The destination channel does not change, which means that the
  1381. * destination channel fails to be updated.
  1382. */
  1383. RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE = 9,
  1384. /** 10: The destination channel name is NULL.
  1385. */
  1386. RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_IS_NULL = 10,
  1387. /** 11: The video profile is sent to the server.
  1388. */
  1389. RELAY_EVENT_VIDEO_PROFILE_UPDATE = 11,
  1390. };
  1391. enum CHANNEL_MEDIA_RELAY_STATE {
  1392. /** 0: The SDK is initializing.
  1393. */
  1394. RELAY_STATE_IDLE = 0,
  1395. /** 1: The SDK tries to relay the media stream to the destination channel.
  1396. */
  1397. RELAY_STATE_CONNECTING = 1,
  1398. /** 2: The SDK successfully relays the media stream to the destination
  1399. * channel.
  1400. */
  1401. RELAY_STATE_RUNNING = 2,
  1402. /** 3: A failure occurs. See the details in code.
  1403. */
  1404. RELAY_STATE_FAILURE = 3,
  1405. };
  1406. /** Statistics of the local video stream.
  1407. */
  1408. struct LocalVideoStats
  1409. {
  1410. /** Bitrate (Kbps) sent in the reported interval, which does not include
  1411. * the bitrate of the re-transmission video after packet loss.
  1412. */
  1413. int sentBitrate;
  1414. /** Frame rate (fps) sent in the reported interval, which does not include
  1415. * the frame rate of the re-transmission video after packet loss.
  1416. */
  1417. int sentFrameRate;
  1418. /** The encoder output frame rate (fps) of the local video.
  1419. */
  1420. int encoderOutputFrameRate;
  1421. /** The render output frame rate (fps) of the local video.
  1422. */
  1423. int rendererOutputFrameRate;
  1424. /** The target bitrate (Kbps) of the current encoder. This value is estimated by the SDK based on the current network conditions.
  1425. */
  1426. int targetBitrate;
  1427. /** The target frame rate (fps) of the current encoder.
  1428. */
  1429. int targetFrameRate;
  1430. /** Quality change of the local video in terms of target frame rate and
  1431. * target bit rate in this reported interval. See #QUALITY_ADAPT_INDICATION.
  1432. */
  1433. QUALITY_ADAPT_INDICATION qualityAdaptIndication;
  1434. /** The encoding bitrate (Kbps), which does not include the bitrate of the
  1435. * re-transmission video after packet loss.
  1436. */
  1437. int encodedBitrate;
  1438. /** The width of the encoding frame (px).
  1439. */
  1440. int encodedFrameWidth;
  1441. /** The height of the encoding frame (px).
  1442. */
  1443. int encodedFrameHeight;
  1444. /** The value of the sent frame rate, represented by an aggregate value.
  1445. */
  1446. int encodedFrameCount;
  1447. /** The codec type of the local video:
  1448. * - VIDEO_CODEC_VP8 = 1: VP8.
  1449. * - VIDEO_CODEC_H264 = 2: (Default) H.264.
  1450. */
  1451. VIDEO_CODEC_TYPE codecType;
  1452. };
  1453. /** Statistics of the remote video stream.
  1454. */
  1455. struct RemoteVideoStats
  1456. {
  1457. /**
  1458. User ID of the remote user sending the video streams.
  1459. */
  1460. uid_t uid;
  1461. /** **DEPRECATED** Time delay (ms).
  1462. */
  1463. int delay;
  1464. /**
  1465. Width (pixels) of the video stream.
  1466. */
  1467. int width;
  1468. /**
  1469. Height (pixels) of the video stream.
  1470. */
  1471. int height;
  1472. /**
  1473. Bitrate (Kbps) received since the last count.
  1474. */
  1475. int receivedBitrate;
  1476. /** The decoder output frame rate (fps) of the remote video.
  1477. */
  1478. int decoderOutputFrameRate;
  1479. /** The render output frame rate (fps) of the remote video.
  1480. */
  1481. int rendererOutputFrameRate;
  1482. /** Packet loss rate (%) of the remote video stream after network
  1483. * countermeasures.
  1484. */
  1485. int packetLossRate;
  1486. REMOTE_VIDEO_STREAM_TYPE rxStreamType;
  1487. /**
  1488. The total freeze time (ms) of the remote video stream after the remote user joins the channel.
  1489. In a video session where the frame rate is set to no less than 5 fps, video freeze occurs when
  1490. the time interval between two adjacent renderable video frames is more than 500 ms.
  1491. */
  1492. int totalFrozenTime;
  1493. /**
  1494. The total video freeze time as a percentage (%) of the total time when the video is available.
  1495. */
  1496. int frozenRate;
  1497. };
  1498. /** Audio statistics of the local user */
  1499. struct LocalAudioStats
  1500. {
  1501. /** The number of channels.
  1502. */
  1503. int numChannels;
  1504. /** The sample rate (Hz).
  1505. */
  1506. int sentSampleRate;
  1507. /** The average sending bitrate (Kbps).
  1508. */
  1509. int sentBitrate;
  1510. };
  1511. /** Audio statistics of a remote user */
  1512. struct RemoteAudioStats
  1513. {
  1514. /** User ID of the remote user sending the audio streams.
  1515. *
  1516. */
  1517. uid_t uid;
  1518. /** Audio quality received by the user: #QUALITY_TYPE.
  1519. */
  1520. int quality;
  1521. /** Network delay (ms) from the sender to the receiver.
  1522. */
  1523. int networkTransportDelay;
  1524. /** Network delay (ms) from the receiver to the jitter buffer.
  1525. */
  1526. int jitterBufferDelay;
  1527. /** Packet loss rate in the reported interval.
  1528. */
  1529. int audioLossRate;
  1530. /** The number of channels.
  1531. */
  1532. int numChannels;
  1533. /** The sample rate (Hz) of the received audio stream in the reported
  1534. * interval.
  1535. */
  1536. int receivedSampleRate;
  1537. /** The average bitrate (Kbps) of the received audio stream in the
  1538. * reported interval. */
  1539. int receivedBitrate;
  1540. /** The total freeze time (ms) of the remote audio stream after the remote user joins the channel. In a session, audio freeze occurs when the audio frame loss rate reaches 4%.
  1541. * Agora uses 2 seconds as an audio piece unit to calculate the audio freeze time. The total audio freeze time = The audio freeze number &times; 2 seconds
  1542. */
  1543. int totalFrozenTime;
  1544. /** The total audio freeze time as a percentage (%) of the total time when the audio is available. */
  1545. int frozenRate;
  1546. };
  1547. /**
  1548. * Video dimensions.
  1549. */
  1550. struct VideoDimensions {
  1551. /** Width (pixels) of the video. */
  1552. int width;
  1553. /** Height (pixels) of the video. */
  1554. int height;
  1555. VideoDimensions()
  1556. : width(640), height(480)
  1557. {}
  1558. VideoDimensions(int w, int h)
  1559. : width(w), height(h)
  1560. {}
  1561. };
  1562. /** (Recommended) The standard bitrate set in the \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration" method.
  1563. In this mode, the bitrates differ between the live broadcast and communication profiles:
  1564. - Communication profile: The video bitrate is the same as the base bitrate.
  1565. - Live broadcast profile: The video bitrate is twice the base bitrate.
  1566. */
  1567. const int STANDARD_BITRATE = 0;
  1568. /** The compatible bitrate set in the \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration" method.
  1569. The bitrate remains the same regardless of the channel profile. If you choose this mode in the Live-broadcast profile, the video frame rate may be lower than the set value.
  1570. */
  1571. const int COMPATIBLE_BITRATE = -1;
  1572. /** Use the default minimum bitrate.
  1573. */
  1574. const int DEFAULT_MIN_BITRATE = -1;
  1575. /** Video encoder configurations.
  1576. */
  1577. struct VideoEncoderConfiguration {
  1578. /** The video frame dimensions (px) used to specify the video quality and measured by the total number of pixels along a frame's width and height: VideoDimensions. The default value is 640 x 360.
  1579. */
  1580. VideoDimensions dimensions;
  1581. /** The frame rate of the video: #FRAME_RATE. The default value is 15.
  1582. Note that we do not recommend setting this to a value greater than 30.
  1583. */
  1584. FRAME_RATE frameRate;
  1585. /** The minimum frame rate of the video. The default value is -1.
  1586. */
  1587. int minFrameRate;
  1588. /** The video encoding bitrate (Kbps).
  1589. Choose one of the following options:
  1590. - #STANDARD_BITRATE: (Recommended) The standard bitrate.
  1591. - The Communication profile: the encoding bitrate equals the base bitrate.
  1592. - The Live-broadcast profile: the encoding bitrate is twice the base bitrate.
  1593. - #COMPATIBLE_BITRATE: The compatible bitrate: the bitrate stays the same regardless of the profile.
  1594. The Communication profile prioritizes smoothness, while the Live-broadcast profile prioritizes video quality (requiring a higher bitrate). We recommend setting the bitrate mode as #STANDARD_BITRATE to address this difference.
  1595. The following table lists the recommended video encoder configurations, where the base bitrate applies to the Communication profile. Set your bitrate based on this table. If you set a bitrate beyond the proper range, the SDK automatically sets it to within the range.
  1596. | Resolution | Frame Rate (fps) | Base Bitrate (Kbps, for Communication) | Live Bitrate (Kbps, for Live Broadcast)|
  1597. |------------------------|------------------|----------------------------------------|----------------------------------------|
  1598. | 160 &times; 120 | 15 | 65 | 130 |
  1599. | 120 &times; 120 | 15 | 50 | 100 |
  1600. | 320 &times; 180 | 15 | 140 | 280 |
  1601. | 180 &times; 180 | 15 | 100 | 200 |
  1602. | 240 &times; 180 | 15 | 120 | 240 |
  1603. | 320 &times; 240 | 15 | 200 | 400 |
  1604. | 240 &times; 240 | 15 | 140 | 280 |
  1605. | 424 &times; 240 | 15 | 220 | 440 |
  1606. | 640 &times; 360 | 15 | 400 | 800 |
  1607. | 360 &times; 360 | 15 | 260 | 520 |
  1608. | 640 &times; 360 | 30 | 600 | 1200 |
  1609. | 360 &times; 360 | 30 | 400 | 800 |
  1610. | 480 &times; 360 | 15 | 320 | 640 |
  1611. | 480 &times; 360 | 30 | 490 | 980 |
  1612. | 640 &times; 480 | 15 | 500 | 1000 |
  1613. | 480 &times; 480 | 15 | 400 | 800 |
  1614. | 640 &times; 480 | 30 | 750 | 1500 |
  1615. | 480 &times; 480 | 30 | 600 | 1200 |
  1616. | 848 &times; 480 | 15 | 610 | 1220 |
  1617. | 848 &times; 480 | 30 | 930 | 1860 |
  1618. | 640 &times; 480 | 10 | 400 | 800 |
  1619. | 1280 &times; 720 | 15 | 1130 | 2260 |
  1620. | 1280 &times; 720 | 30 | 1710 | 3420 |
  1621. | 960 &times; 720 | 15 | 910 | 1820 |
  1622. | 960 &times; 720 | 30 | 1380 | 2760 |
  1623. | 1920 &times; 1080 | 15 | 2080 | 4160 |
  1624. | 1920 &times; 1080 | 30 | 3150 | 6300 |
  1625. | 1920 &times; 1080 | 60 | 4780 | 6500 |
  1626. | 2560 &times; 1440 | 30 | 4850 | 6500 |
  1627. | 2560 &times; 1440 | 60 | 6500 | 6500 |
  1628. | 3840 &times; 2160 | 30 | 6500 | 6500 |
  1629. | 3840 &times; 2160 | 60 | 6500 | 6500 |
  1630. */
  1631. int bitrate;
  1632. /** The minimum encoding bitrate (Kbps).
  1633. The SDK automatically adjusts the encoding bitrate to adapt to the network conditions. Using a value greater than the default value forces the video encoder to output high-quality images but may cause more packet loss and hence sacrifice the smoothness of the video transmission. That said, unless you have special requirements for image quality, Agora does not recommend changing this value.
  1634. @note This parameter applies only to the Live-broadcast profile.
  1635. */
  1636. int minBitrate;
  1637. /** The video orientation mode of the video: #ORIENTATION_MODE.
  1638. */
  1639. ORIENTATION_MODE orientationMode;
  1640. /** the video encoding degradation preference under limited bandwidth: #DEGRADATION_PREFERENCE.
  1641. */
  1642. DEGRADATION_PREFERENCE degradationPreference;
  1643. VideoEncoderConfiguration(
  1644. const VideoDimensions& d, FRAME_RATE f,
  1645. int b, ORIENTATION_MODE m)
  1646. : dimensions(d), frameRate(f), minFrameRate(-1), bitrate(b),
  1647. minBitrate(DEFAULT_MIN_BITRATE), orientationMode(m),
  1648. degradationPreference(MAINTAIN_QUALITY)
  1649. {}
  1650. VideoEncoderConfiguration(
  1651. int width, int height, FRAME_RATE f,
  1652. int b, ORIENTATION_MODE m)
  1653. : dimensions(width, height), frameRate(f),
  1654. minFrameRate(-1), bitrate(b),
  1655. minBitrate(DEFAULT_MIN_BITRATE), orientationMode(m),
  1656. degradationPreference(MAINTAIN_QUALITY)
  1657. {}
  1658. VideoEncoderConfiguration()
  1659. : dimensions(640, 480)
  1660. , frameRate(FRAME_RATE_FPS_15)
  1661. , minFrameRate(-1)
  1662. , bitrate(STANDARD_BITRATE)
  1663. , minBitrate(DEFAULT_MIN_BITRATE)
  1664. , orientationMode(ORIENTATION_MODE_ADAPTIVE)
  1665. , degradationPreference(MAINTAIN_QUALITY)
  1666. {}
  1667. };
  1668. /** The video properties of the user displaying the video in the CDN live. Agora supports a maximum of 17 transcoding users in a CDN streaming channel.
  1669. */
  1670. typedef struct TranscodingUser {
  1671. /** User ID of the user displaying the video in the CDN live.
  1672. */
  1673. uid_t uid;
  1674. /** Horizontal position from the top left corner of the video frame.
  1675. */
  1676. int x;
  1677. /** Vertical position from the top left corner of the video frame.
  1678. */
  1679. int y;
  1680. /** Width of the video frame. The default value is 360.
  1681. */
  1682. int width;
  1683. /** Height of the video frame. The default value is 640.
  1684. */
  1685. int height;
  1686. /** Layer position of the video frame. The value ranges between 0 and 100.
  1687. - 0: (Default) Lowest
  1688. - 100: Highest
  1689. @note
  1690. - If zOrder is beyond this range, the SDK reports #ERR_INVALID_ARGUMENT.
  1691. - As of v2.3, the SDK supports zOrder = 0.
  1692. */
  1693. int zOrder;
  1694. /** Transparency of the video frame in CDN live. The value ranges between 0 and 1.0:
  1695. - 0: Completely transparent
  1696. - 1.0: (Default) Opaque
  1697. */
  1698. double alpha;
  1699. /** The audio channel of the sound. The default value is 0:
  1700. - 0: (Default) Supports dual channels at most, depending on the upstream of the broadcaster.
  1701. - 1: The audio stream of the broadcaster uses the FL audio channel. If the upstream of the broadcaster uses multiple audio channels, these channels are mixed into mono first.
  1702. - 2: The audio stream of the broadcaster uses the FC audio channel. If the upstream of the broadcaster uses multiple audio channels, these channels are mixed into mono first.
  1703. - 3: The audio stream of the broadcaster uses the FR audio channel. If the upstream of the broadcaster uses multiple audio channels, these channels are mixed into mono first.
  1704. - 4: The audio stream of the broadcaster uses the BL audio channel. If the upstream of the broadcaster uses multiple audio channels, these channels are mixed into mono first.
  1705. - 5: The audio stream of the broadcaster uses the BR audio channel. If the upstream of the broadcaster uses multiple audio channels, these channels are mixed into mono first.
  1706. @note If your setting is not 0, you may need a specialized player.
  1707. */
  1708. int audioChannel;
  1709. TranscodingUser()
  1710. : uid(0)
  1711. , x(0)
  1712. , y(0)
  1713. , width(0)
  1714. , height(0)
  1715. , zOrder(0)
  1716. , alpha(1.0)
  1717. , audioChannel(0)
  1718. {}
  1719. } TranscodingUser;
  1720. /** Image properties.
  1721. The properties of the watermark and background images.
  1722. */
  1723. typedef struct RtcImage {
  1724. RtcImage() :
  1725. url(NULL),
  1726. x(0),
  1727. y(0),
  1728. width(0),
  1729. height(0)
  1730. {}
  1731. /** HTTP/HTTPS URL address of the image on the broadcasting video. The maximum length of this parameter is 1024 bytes. */
  1732. const char* url;
  1733. /** Horizontal position of the image from the upper left of the broadcasting video. */
  1734. int x;
  1735. /** Vertical position of the image from the upper left of the broadcasting video. */
  1736. int y;
  1737. /** Width of the image on the broadcasting video. */
  1738. int width;
  1739. /** Height of the image on the broadcasting video. */
  1740. int height;
  1741. } RtcImage;
  1742. /** A struct for managing CDN live audio/video transcoding settings.
  1743. */
  1744. typedef struct LiveTranscoding {
  1745. /** Width of the video. The default value is 360. The minimum value of width &times; height is 16 &times; 16.
  1746. */
  1747. int width;
  1748. /** Height of the video. The default value is 640. The minimum value of width &times; height is 16 &times; 16.
  1749. */
  1750. int height;
  1751. /** Bitrate of the CDN live output video stream. The default value is 400 Kbps.
  1752. Set this parameter according to the Video Bitrate Table. If you set a bitrate beyond the proper range, the SDK automatically adapts it to a value within the range.
  1753. */
  1754. int videoBitrate;
  1755. /** Frame rate of the output video stream set for the CDN live broadcast. The default value is 15 fps.
  1756. @note Agora adjusts all values over 30 to 30.
  1757. */
  1758. int videoFramerate;
  1759. /** **DEPRECATED** Latency mode:
  1760. - true: Low latency with unassured quality.
  1761. - false: (Default) High latency with assured quality.
  1762. */
  1763. bool lowLatency;
  1764. /** Video GOP in frames. The default value is 30 fps.
  1765. */
  1766. int videoGop;
  1767. /** Self-defined video codec profile: #VIDEO_CODEC_PROFILE_TYPE.
  1768. @note If you set this parameter to other values, Agora adjusts it to the default value of 100.
  1769. */
  1770. VIDEO_CODEC_PROFILE_TYPE videoCodecProfile;
  1771. /** The background color in RGB hex value. Value only, do not include a #. For example, 0xFFB6C1 (light pink). The default value is 0x000000 (black).
  1772. */
  1773. unsigned int backgroundColor;
  1774. /** The number of users in the live broadcast.
  1775. */
  1776. unsigned int userCount;
  1777. /** TranscodingUser
  1778. */
  1779. TranscodingUser *transcodingUsers;
  1780. /** Reserved property. Extra user-defined information to send SEI for the H.264/H.265 video stream to the CDN live client. Maximum length: 4096 Bytes.
  1781. For more information on SEI frame, see [SEI-related questions](https://docs.agora.io/cn/Agora%20Platform/live_related_faq?platform=%E7%9B%B4%E6%92%AD%E7%9B%B8%E5%85%B3#sei).
  1782. */
  1783. const char *transcodingExtraInfo;
  1784. /** **DEPRECATED** The metadata sent to the CDN live client defined by the RTMP or FLV metadata.
  1785. */
  1786. const char *metadata;
  1787. /** The watermark image added to the CDN live publishing stream.
  1788. Ensure that the format of the image is PNG. Once a watermark image is added, the audience of the CDN live publishing stream can see the watermark image. See RtcImage.
  1789. */
  1790. RtcImage* watermark;
  1791. /** The background image added to the CDN live publishing stream.
  1792. Once a background image is added, the audience of the CDN live publishing stream can see the background image. See RtcImage.
  1793. */
  1794. RtcImage* backgroundImage;
  1795. /** Self-defined audio-sample rate: #AUDIO_SAMPLE_RATE_TYPE.
  1796. */
  1797. AUDIO_SAMPLE_RATE_TYPE audioSampleRate;
  1798. /** Bitrate of the CDN live audio output stream. The default value is 48 Kbps, and the highest value is 128.
  1799. */
  1800. int audioBitrate;
  1801. /** Agora's self-defined audio-channel types. We recommend choosing option 1 or 2. A special player is required if you choose option 3, 4, or 5:
  1802. - 1: (Default) Mono
  1803. - 2: Two-channel stereo
  1804. - 3: Three-channel stereo
  1805. - 4: Four-channel stereo
  1806. - 5: Five-channel stereo
  1807. */
  1808. int audioChannels;
  1809. /** Self-defined audio codec profile: #AUDIO_CODEC_PROFILE_TYPE.
  1810. */
  1811. AUDIO_CODEC_PROFILE_TYPE audioCodecProfile;
  1812. LiveTranscoding()
  1813. : width(360)
  1814. , height(640)
  1815. , videoBitrate(400)
  1816. , videoFramerate(15)
  1817. , lowLatency(false)
  1818. , videoGop(30)
  1819. , videoCodecProfile(VIDEO_CODEC_PROFILE_HIGH)
  1820. , backgroundColor(0x000000)
  1821. , userCount(0)
  1822. , transcodingUsers(NULL)
  1823. , transcodingExtraInfo(NULL)
  1824. , metadata(NULL)
  1825. , watermark(NULL)
  1826. , backgroundImage(NULL)
  1827. , audioSampleRate(AUDIO_SAMPLE_RATE_48000)
  1828. , audioBitrate(48)
  1829. , audioChannels(1)
  1830. , audioCodecProfile(AUDIO_CODEC_PROFILE_LC_AAC)
  1831. {}
  1832. } LiveTranscoding;
  1833. /** Camera capturer configuration.
  1834. */
  1835. struct CameraCapturerConfiguration{
  1836. /** Camera capturer preference settings.See: #CAPTURER_OUTPUT_PREFERENCE. */
  1837. CAPTURER_OUTPUT_PREFERENCE preference;
  1838. };
  1839. /** Configuration of the imported live broadcast voice or video stream.
  1840. */
  1841. struct InjectStreamConfig {
  1842. /** Width of the added stream in the live broadcast. The default value is 0 (same width as the original stream).
  1843. */
  1844. int width;
  1845. /** Height of the added stream in the live broadcast. The default value is 0 (same height as the original stream).
  1846. */
  1847. int height;
  1848. /** Video GOP of the added stream in the live broadcast in frames. The default value is 30 fps.
  1849. */
  1850. int videoGop;
  1851. /** Video frame rate of the added stream in the live broadcast. The default value is 15 fps.
  1852. */
  1853. int videoFramerate;
  1854. /** Video bitrate of the added stream in the live broadcast. The default value is 400 Kbps.
  1855. @note The setting of the video bitrate is closely linked to the resolution. If the video bitrate you set is beyond a reasonable range, the SDK sets it within a reasonable range.
  1856. */
  1857. int videoBitrate;
  1858. /** Audio-sample rate of the added stream in the live broadcast: #AUDIO_SAMPLE_RATE_TYPE. The default value is 48000 Hz.
  1859. @note We recommend setting the default value.
  1860. */
  1861. AUDIO_SAMPLE_RATE_TYPE audioSampleRate;
  1862. /** Audio bitrate of the added stream in the live broadcast. The default value is 48.
  1863. @note We recommend setting the default value.
  1864. */
  1865. int audioBitrate;
  1866. /** Audio channels in the live broadcast.
  1867. - 1: (Default) Mono
  1868. - 2: Two-channel stereo
  1869. @note We recommend setting the default value.
  1870. */
  1871. int audioChannels;
  1872. // width / height default set to 0 means pull the stream with its original resolution
  1873. InjectStreamConfig()
  1874. : width(0)
  1875. , height(0)
  1876. , videoGop(30)
  1877. , videoFramerate(15)
  1878. , videoBitrate(400)
  1879. , audioSampleRate(AUDIO_SAMPLE_RATE_48000)
  1880. , audioBitrate(48)
  1881. , audioChannels(1)
  1882. {}
  1883. };
  1884. /** The definition of ChannelMediaInfo.
  1885. */
  1886. struct ChannelMediaInfo {
  1887. /** The channel name. The default value is NULL, which means that the SDK
  1888. * applies the current channel name.
  1889. */
  1890. const char* channelName;
  1891. /** The token that enables the user to join the channel. The default value
  1892. * is NULL, which means that the SDK applies the current token.
  1893. */
  1894. const char* token;
  1895. /** The user ID.
  1896. *
  1897. * @note
  1898. * String user accounts are not supported in media stream relay.
  1899. */
  1900. uid_t uid;
  1901. };
  1902. /** The definition of ChannelMediaRelayConfiguration.
  1903. */
  1904. struct ChannelMediaRelayConfiguration {
  1905. /** Pointer to the source channel: ChannelMediaInfo.
  1906. *
  1907. * @note
  1908. * - `uid`: ID of the user whose media stream you want to relay. We
  1909. * recommend setting it as 0, which means that the SDK relays the media
  1910. * stream of the current broadcaster.
  1911. * - If you do not use a token, we recommend using the default values of
  1912. * the parameters in ChannelMediaInfo.
  1913. * - If you use a token, set uid as 0, and ensure that the token is
  1914. * generated with the uid set as 0.
  1915. */
  1916. ChannelMediaInfo *srcInfo;
  1917. /** Pointer to the destination channel: ChannelMediaInfo. If you want to
  1918. * relay the media stream to multiple channels, define as many
  1919. * ChannelMediaInfo structs (at most four).
  1920. *
  1921. * @note `uid`: ID of the user who is in the source channel.
  1922. */
  1923. ChannelMediaInfo *destInfos;
  1924. /** The number of destination channels. The default value is 0, and the
  1925. * value range is [0,4). Ensure that the value of this parameter
  1926. * corresponds to the number of ChannelMediaInfo structs you define in
  1927. * `destInfos`.
  1928. */
  1929. int destCount;
  1930. ChannelMediaRelayConfiguration()
  1931. : srcInfo(nullptr)
  1932. , destInfos(nullptr)
  1933. , destCount(0)
  1934. {}
  1935. };
  1936. /** **DEPRECATED** Lifecycle of the CDN live video stream.
  1937. */
  1938. enum RTMP_STREAM_LIFE_CYCLE_TYPE
  1939. {
  1940. /** Bind to the channel lifecycle. If all hosts leave the channel, the CDN live streaming stops after 30 seconds.
  1941. */
  1942. RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL = 1,
  1943. /** Bind to the owner of the RTMP stream. If the owner leaves the channel, the CDN live streaming stops immediately.
  1944. */
  1945. RTMP_STREAM_LIFE_CYCLE_BIND2OWNER = 2,
  1946. };
  1947. /** Content hints for screen sharing.
  1948. */
  1949. enum VideoContentHint
  1950. {
  1951. /** (Default) No content hint.
  1952. */
  1953. CONTENT_HINT_NONE,
  1954. /** Motion-intensive content. Choose this option if you prefer smoothness or when you are sharing a video clip, movie, or video game.
  1955. */
  1956. CONTENT_HINT_MOTION,
  1957. /** Motionless content. Choose this option if you prefer sharpness or when you are sharing a picture, PowerPoint slide, or text.
  1958. */
  1959. CONTENT_HINT_DETAILS
  1960. };
  1961. /** The relative location of the region to the screen or window.
  1962. */
  1963. struct Rectangle
  1964. {
  1965. /** The horizontal offset from the top-left corner.
  1966. */
  1967. int x;
  1968. /** The vertical offset from the top-left corner.
  1969. */
  1970. int y;
  1971. /** The width of the region.
  1972. */
  1973. int width;
  1974. /** The height of the region.
  1975. */
  1976. int height;
  1977. Rectangle(): x(0), y(0), width(0), height(0) {}
  1978. Rectangle(int xx, int yy, int ww, int hh): x(xx), y(yy), width(ww), height(hh) {}
  1979. };
  1980. /** **DEPRECATED** Definition of the rectangular region. */
  1981. typedef struct Rect {
  1982. /** Y-axis of the top line.
  1983. */
  1984. int top;
  1985. /** X-axis of the left line.
  1986. */
  1987. int left;
  1988. /** Y-axis of the bottom line.
  1989. */
  1990. int bottom;
  1991. /** X-axis of the right line.
  1992. */
  1993. int right;
  1994. Rect(): top(0), left(0), bottom(0), right(0) {}
  1995. Rect(int t, int l, int b, int r): top(t), left(l), bottom(b), right(r) {}
  1996. } Rect;
  1997. /** Screen sharing encoding parameters.
  1998. */
  1999. struct ScreenCaptureParameters
  2000. {
  2001. /** The maximum encoding dimensions of the shared region in terms of width &times; height.
  2002. The default value is 1920 &times; 1080 pixels, that is, 2073600 pixels. Agora uses the value of this parameter to calculate the charges.
  2003. If the aspect ratio is different between the encoding dimensions and screen dimensions, Agora applies the following algorithms for encoding. Suppose the encoding dimensions are 1920 x 1080:
  2004. - If the value of the screen dimensions is lower than that of the encoding dimensions, for example, 1000 &times; 1000, the SDK uses 1000 &times; 1000 for encoding.
  2005. - If the value of the screen dimensions is higher than that of the encoding dimensions, for example, 2000 &times; 1500, the SDK uses the maximum value under 1920 &times; 1080 with the aspect ratio of the screen dimension (4:3) for encoding, that is, 1440 &times; 1080.
  2006. */
  2007. VideoDimensions dimensions;
  2008. /** The frame rate (fps) of the shared region.
  2009. The default value is 5. We do not recommend setting this to a value greater than 15.
  2010. */
  2011. int frameRate;
  2012. /** The bitrate (Kbps) of the shared region.
  2013. The default value is 0 (the SDK works out a bitrate according to the dimensions of the current screen).
  2014. */
  2015. int bitrate;
  2016. /** Sets whether or not to capture the mouse for screen sharing:
  2017. - true: (Default) Capture the mouse.
  2018. - false: Do not capture the mouse.
  2019. */
  2020. bool captureMouseCursor;
  2021. ScreenCaptureParameters() : dimensions(1920, 1080), frameRate(5), bitrate(STANDARD_BITRATE), captureMouseCursor(true) {}
  2022. ScreenCaptureParameters(const VideoDimensions& d, int f, int b, bool c) : dimensions(d), frameRate(f), bitrate(b), captureMouseCursor(c) {}
  2023. ScreenCaptureParameters(int width, int height, int f, int b, bool c) : dimensions(width, height), frameRate(f), bitrate(b), captureMouseCursor(c) {}
  2024. };
  2025. /** Video display settings of the VideoCanvas class.
  2026. */
  2027. struct VideoCanvas
  2028. {
  2029. /** Video display window (view).
  2030. */
  2031. view_t view;
  2032. /** Video display mode: #RENDER_MODE_TYPE.
  2033. */
  2034. int renderMode;
  2035. uid_t uid;
  2036. void *priv; // private data (underlying video engine denotes it)
  2037. VideoCanvas()
  2038. : view(NULL)
  2039. , renderMode(RENDER_MODE_HIDDEN)
  2040. , uid(0)
  2041. , priv(NULL)
  2042. {}
  2043. VideoCanvas(view_t v, int m, uid_t u)
  2044. : view(v)
  2045. , renderMode(m)
  2046. , uid(u)
  2047. , priv(NULL)
  2048. {}
  2049. };
  2050. /** Image enhancement options.
  2051. */
  2052. struct BeautyOptions {
  2053. /** The contrast level, used with the @p lightening parameter.
  2054. */
  2055. enum LIGHTENING_CONTRAST_LEVEL
  2056. {
  2057. /** Low contrast level. */
  2058. LIGHTENING_CONTRAST_LOW = 0,
  2059. /** (Default) Normal contrast level. */
  2060. LIGHTENING_CONTRAST_NORMAL,
  2061. /** High contrast level. */
  2062. LIGHTENING_CONTRAST_HIGH
  2063. };
  2064. /** The contrast level, used with the @p lightening parameter.
  2065. */
  2066. LIGHTENING_CONTRAST_LEVEL lighteningContrastLevel;
  2067. /** The brightness level. The value ranges from 0.0 (original) to 1.0. */
  2068. float lighteningLevel;
  2069. /** The sharpness level. The value ranges between 0 (original) and 1. This parameter is usually used to remove blemishes.
  2070. */
  2071. float smoothnessLevel;
  2072. /** The redness level. The value ranges between 0 (original) and 1. This parameter adjusts the red saturation level.
  2073. */
  2074. float rednessLevel;
  2075. BeautyOptions(LIGHTENING_CONTRAST_LEVEL contrastLevel, float lightening, float smoothness, float redness)
  2076. : lighteningLevel(lightening),
  2077. smoothnessLevel(smoothness),
  2078. rednessLevel(redness),
  2079. lighteningContrastLevel(contrastLevel) {}
  2080. BeautyOptions()
  2081. : lighteningLevel(0),
  2082. smoothnessLevel(0),
  2083. rednessLevel(0),
  2084. lighteningContrastLevel(LIGHTENING_CONTRAST_NORMAL) {}
  2085. };
  2086. struct UserInfo {
  2087. uid_t uid;
  2088. char userAccount[MAX_USER_ACCOUNT_LENGTH];
  2089. UserInfo()
  2090. : uid(0) {
  2091. userAccount[0] = '\0';
  2092. }
  2093. };
  2094. /** Definition of IPacketObserver.
  2095. */
  2096. class IPacketObserver
  2097. {
  2098. public:
  2099. /** Definition of Packet.
  2100. */
  2101. struct Packet
  2102. {
  2103. /** Buffer address of the sent or received data.
  2104. */
  2105. const unsigned char* buffer;
  2106. /** Buffer size of the sent or received data.
  2107. */
  2108. unsigned int size;
  2109. };
  2110. /** Occurs when the local user sends an audio packet.
  2111. @param packet The sent audio packet. See Packet.
  2112. @return
  2113. - true: The audio packet is sent successfully.
  2114. - false: The audio packet is discarded.
  2115. */
  2116. virtual bool onSendAudioPacket(Packet& packet) = 0;
  2117. /** Occurs when the local user sends a video packet.
  2118. @param packet The sent video packet. See Packet.
  2119. @return
  2120. - true: The video packet is sent successfully.
  2121. - false: The video packet is discarded.
  2122. */
  2123. virtual bool onSendVideoPacket(Packet& packet) = 0;
  2124. /** Occurs when the local user receives an audio packet.
  2125. @param packet The received audio packet. See Packet.
  2126. @return
  2127. - true: The audio packet is received successfully.
  2128. - false: The audio packet is discarded.
  2129. */
  2130. virtual bool onReceiveAudioPacket(Packet& packet) = 0;
  2131. /** Occurs when the local user receives a video packet.
  2132. @param packet The received video packet. See Packet.
  2133. @return
  2134. - true: The video packet is received successfully.
  2135. - false: The video packet is discarded.
  2136. */
  2137. virtual bool onReceiveVideoPacket(Packet& packet) = 0;
  2138. };
  2139. /** The SDK uses the IRtcEngineEventHandler interface class to send callbacks to the application. The application inherits the methods of this interface class to retrieve these callbacks.
  2140. All methods in this interface class have default (empty) implementations. Therefore, the application can only inherit some required events. In the callbacks, avoid time-consuming tasks or calling blocking APIs, such as the SendMessage method. Otherwise, the SDK may not work properly.
  2141. */
  2142. class IRtcEngineEventHandler
  2143. {
  2144. public:
  2145. virtual ~IRtcEngineEventHandler() {}
  2146. /** Reports a warning during SDK runtime.
  2147. In most cases, the application can ignore the warning reported by the SDK because the SDK can usually fix the issue and resume running. For example, when losing connection with the server, the SDK may report #WARN_LOOKUP_CHANNEL_TIMEOUT and automatically try to reconnect.
  2148. @param warn Warning code: #WARN_CODE_TYPE.
  2149. @param msg Pointer to the warning message.
  2150. */
  2151. virtual void onWarning(int warn, const char* msg) {
  2152. (void)warn;
  2153. (void)msg;
  2154. }
  2155. /** Reports an error during SDK runtime.
  2156. In most cases, the SDK cannot fix the issue and resume running. The SDK requires the application to take action or informs the user about the issue.
  2157. For example, the SDK reports an #ERR_START_CALL error when failing to initialize a call. The application informs the user that the call initialization failed and invokes the \ref IRtcEngine::leaveChannel "leaveChannel" method to leave the channel.
  2158. @param err Error code: #ERROR_CODE_TYPE.
  2159. @param msg Pointer to the error message.
  2160. */
  2161. virtual void onError(int err, const char* msg) {
  2162. (void)err;
  2163. (void)msg;
  2164. }
  2165. /** Occurs when a user joins a specified channel.
  2166. This callback notifies the application that a user joins a specified channel when the application calls the \ref IRtcEngine::joinChannel "joinChannel" method.
  2167. The channel name assignment is based on @p channelName specified in the \ref IRtcEngine::joinChannel "joinChannel" method.
  2168. If the @p uid is not specified in the *joinChannel* method, the server automatically assigns a @p uid.
  2169. @param channel Pointer to the channel name.
  2170. @param uid User ID of the user joining the channel.
  2171. @param elapsed Time elapsed (ms) from the user calling the \ref IRtcEngine::joinChannel "joinChannel" method until the SDK triggers this callback.
  2172. */
  2173. virtual void onJoinChannelSuccess(const char* channel, uid_t uid, int elapsed) {
  2174. (void)channel;
  2175. (void)uid;
  2176. (void)elapsed;
  2177. }
  2178. /** Occurs when a user rejoins the channel after disconnection due to network problems.
  2179. When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect and triggers this callback upon reconnection.
  2180. @param channel Pointer to the channel name.
  2181. @param uid User ID of the user rejoining the channel.
  2182. @param elapsed Time elapsed (ms) from starting to reconnect until the SDK triggers this callback.
  2183. */
  2184. virtual void onRejoinChannelSuccess(const char* channel, uid_t uid, int elapsed) {
  2185. (void)channel;
  2186. (void)uid;
  2187. (void)elapsed;
  2188. }
  2189. /** Occurs when a user leaves the channel.
  2190. This callback notifies the application that a user leaves the channel when the application calls the \ref IRtcEngine::leaveChannel "leaveChannel" method.
  2191. The application retrieves information, such as the call duration and statistics.
  2192. @param stats Pointer to the statistics of the call: RtcStats.
  2193. */
  2194. virtual void onLeaveChannel(const RtcStats& stats) {
  2195. (void)stats;
  2196. }
  2197. /** Occurs when the user role switches in a live broadcast. For example, from a host to an audience or vice versa.
  2198. This callback notifies the application of a user role switch when the application calls the \ref IRtcEngine::setClientRole "setClientRole" method.
  2199. The SDK triggers this callback when the local user switches the user role by calling the \ref agora::rtc::IRtcEngine::setClientRole "setClientRole" method after joining the channel.
  2200. @param oldRole Role that the user switches from: #CLIENT_ROLE_TYPE.
  2201. @param newRole Role that the user switches to: #CLIENT_ROLE_TYPE.
  2202. */
  2203. virtual void onClientRoleChanged(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole) {
  2204. }
  2205. /** Occurs when a user or host joins the channel.
  2206. - Communication profile: This callback notifies the application that another user joins the channel. If other users are already in the channel, the SDK also reports to the application on the existing users.
  2207. - Live-broadcast profile: This callback notifies the application that the host joins the channel. If other hosts are already in the channel, the SDK also reports to the application on the existing hosts. We recommend limiting the number of hosts to 17.
  2208. The SDK triggers this callback under one of the following circumstances:
  2209. - A remote user/host joins the channel by calling the \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method.
  2210. - A remote user switches the user role to the host by calling the \ref agora::rtc::IRtcEngine::setClientRole "setClientRole" method after joining the channel.
  2211. - A remote user/host rejoins the channel after a network interruption.
  2212. - The host injects an online media stream into the channel by calling the \ref agora::rtc::IRtcEngine::addInjectStreamUrl "addInjectStreamUrl" method.
  2213. @note In the Live-broadcast profile:
  2214. - The host receives this callback when another host joins the channel.
  2215. - The audience in the channel receives this callback when a new host joins the channel.
  2216. - When a web application joins the channel, the SDK triggers this callback as long as the web application publishes streams.
  2217. @param uid User ID of the user or host joining the channel.
  2218. @param elapsed Time delay (ms) from the local user calling the \ref IRtcEngine::joinChannel "joinChannel" method until the SDK triggers this callback.
  2219. */
  2220. virtual void onUserJoined(uid_t uid, int elapsed) {
  2221. (void)uid;
  2222. (void)elapsed;
  2223. }
  2224. /** Occurs when a remote user (Communication)/host (Live Broadcast) leaves the channel.
  2225. Reasons why the user is offline:
  2226. - Leave the channel: When the user/host leaves the channel, the user/host sends a goodbye message. When the message is received, the SDK assumes that the user/host leaves the channel.
  2227. - Drop offline: When no data packet of the user or host is received for a certain period of time (20 seconds for the Communication profile, and more for the Live-broadcast profile), the SDK assumes that the user/host drops offline. Unreliable network connections may lead to false detections, so we recommend using a signaling system for more reliable offline detection.
  2228. @param uid User ID of the user leaving the channel or going offline.
  2229. @param reason Reason why the user is offline: #USER_OFFLINE_REASON_TYPE.
  2230. */
  2231. virtual void onUserOffline(uid_t uid, USER_OFFLINE_REASON_TYPE reason) {
  2232. (void)uid;
  2233. (void)reason;
  2234. }
  2235. /** Reports the last mile network quality of the local user once every two seconds before the user joins the channel.
  2236. Last mile refers to the connection between the local device and Agora's edge server. After the application calls the \ref IRtcEngine::enableLastmileTest "enableLastmileTest" method, this callback reports once every two seconds the uplink and downlink last mile network conditions of the local user before the user joins the channel.
  2237. @param quality The last mile network quality: #QUALITY_TYPE.
  2238. */
  2239. virtual void onLastmileQuality(int quality) {
  2240. (void)quality;
  2241. }
  2242. /** Reports the last-mile network probe result.
  2243. The SDK triggers this callback within 30 seconds after the app calls the \ref agora::rtc::IRtcEngine::startLastmileProbeTest "startLastmileProbeTest" method.
  2244. @param result The uplink and downlink last-mile network probe test result. See LastmileProbeResult.
  2245. */
  2246. virtual void onLastmileProbeResult(const LastmileProbeResult& result) {
  2247. (void)result;
  2248. }
  2249. /** **DEPRECATED** Occurs when the connection between the SDK and the server is interrupted.
  2250. Deprecated as of v2.3.2. Replaced by the \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged(CONNECTION_STATE_RECONNECTING, CONNECTION_CHANGED_INTERRUPTED)" callback.
  2251. The SDK triggers this callback when it loses connection with the server for more than four seconds after the connection is established.
  2252. After triggering this callback, the SDK tries reconnecting to the server. You can use this callback to implement pop-up reminders.
  2253. This callback is different from \ref agora::rtc::IRtcEngineEventHandler::onConnectionLost "onConnectionLost":
  2254. - The SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onConnectionInterrupted "onConnectionInterrupted" callback when it loses connection with the server for more than four seconds after it successfully joins the channel.
  2255. - The SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onConnectionLost "onConnectionLost" callback when it loses connection with the server for more than 10 seconds, whether or not it joins the channel.
  2256. For both callbacks, the SDK tries to reconnect to the server until the application calls the \ref IRtcEngine::leaveChannel "leaveChannel" method.
  2257. */
  2258. virtual void onConnectionInterrupted() {}
  2259. /** Occurs when the SDK cannot reconnect to Agora's edge server 10 seconds after its connection to the server is interrupted.
  2260. The SDK triggers this callback when it cannot connect to the server 10 seconds after calling the \ref IRtcEngine::joinChannel "joinChannel" method, whether or not it is in the channel.
  2261. This callback is different from \ref agora::rtc::IRtcEngineEventHandler::onConnectionInterrupted "onConnectionInterrupted":
  2262. - The SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onConnectionInterrupted "onConnectionInterrupted" callback when it loses connection with the server for more than four seconds after it successfully joins the channel.
  2263. - The SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onConnectionLost "onConnectionLost" callback when it loses connection with the server for more than 10 seconds, whether or not it joins the channel.
  2264. For both callbacks, the SDK tries to reconnect to the server until the application calls the \ref IRtcEngine::leaveChannel "leaveChannel" method.
  2265. */
  2266. virtual void onConnectionLost() {}
  2267. /** **DEPRECATED** Deprecated as of v2.3.2. Replaced by the \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged(CONNECTION_STATE_FAILED, CONNECTION_CHANGED_BANNED_BY_SERVER)" callback.
  2268. Occurs when your connection is banned by the Agora Server.
  2269. */
  2270. virtual void onConnectionBanned() {}
  2271. /** Occurs when a method is executed by the SDK.
  2272. @param err The error code (#ERROR_CODE_TYPE) returned by the SDK when a method call fails. If the SDK returns 0, then the method call is successful.
  2273. @param api Pointer to the method executed by the SDK.
  2274. @param result Pointer to the result of the method call.
  2275. */
  2276. virtual void onApiCallExecuted(int err, const char* api, const char* result) {
  2277. (void)err;
  2278. (void)api;
  2279. (void)result;
  2280. }
  2281. /** Occurs when the token expires.
  2282. After a token is specified by calling the \ref IRtcEngine::joinChannel "joinChannel" method, if the SDK losses connection with the Agora server due to network issues, the token may expire after a certain period of time and a new token may be required to reconnect to the server.
  2283. This callback notifies the application to generate a new token. Call the \ref IRtcEngine::renewToken "renewToken" method to renew the token.
  2284. */
  2285. virtual void onRequestToken() {
  2286. }
  2287. /** Occurs when the token expires in 30 seconds.
  2288. The user becomes offline if the token used in the \ref IRtcEngine::joinChannel "joinChannel" method expires. The SDK triggers this callback 30 seconds before the token expires to remind the application to get a new token. Upon receiving this callback, generate a new token on the server and call the \ref IRtcEngine::renewToken "renewToken" method to pass the new token to the SDK.
  2289. @param token Pointer to the token that expires in 30 seconds.
  2290. */
  2291. virtual void onTokenPrivilegeWillExpire(const char* token) {
  2292. (void)token;
  2293. }
  2294. /** **DEPRECATED** Reports the statistics of the audio stream from each remote user/host.
  2295. Deprecated as of v2.3.2. Use the \ref agora::rtc::IRtcEngineEventHandler::onRemoteAudioStats "onRemoteAudioStats" callback instead.
  2296. The SDK triggers this callback once every two seconds to report the audio quality of each remote user/host sending an audio stream. If a channel has multiple users/hosts sending audio streams, the SDK triggers this callback as many times.
  2297. @param uid User ID of the speaker.
  2298. @param quality Audio quality of the user: #QUALITY_TYPE.
  2299. @param delay Time delay (ms) of sending the audio packet from the sender to the receiver, including the time delay of audio sampling pre-processing, transmission, and the jitter buffer.
  2300. @param lost Packet loss rate (%) of the audio packet sent from the sender to the receiver.
  2301. */
  2302. virtual void onAudioQuality(uid_t uid, int quality, unsigned short delay, unsigned short lost) {
  2303. (void)uid;
  2304. (void)quality;
  2305. (void)delay;
  2306. (void)lost;
  2307. }
  2308. /** Reports the statistics of the current call session once every two
  2309. * seconds.
  2310. *
  2311. * @param stats Pointer to the RTC engine statistics: RtcStats.
  2312. */
  2313. virtual void onRtcStats(const RtcStats& stats) {
  2314. (void)stats;
  2315. }
  2316. /** Reports the last mile network quality of each user in the channel once every two seconds.
  2317. Last mile refers to the connection between the local device and Agora's edge server. This callback reports once every two seconds the last mile network conditions of each user in the channel. If a channel includes multiple users, the SDK triggers this callback as many times.
  2318. @param uid User ID. The network quality of the user with this @p uid is reported. If @p uid is 0, the local network quality is reported.
  2319. @param txQuality Uplink transmission quality rating of the user in terms of the transmission bitrate, packet loss rate, average RTT (Round-Trip Time), and jitter of the uplink network. @p txQuality is a quality rating helping you understand how well the current uplink network conditions can support the selected VideoEncoderConfiguration. For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 640 &times; 480 and a frame rate of 15 fps in the Live-broadcast profile, but may be inadequate for resolutions higher than 1280 &times; 720. See #QUALITY_TYPE.
  2320. @param rxQuality Downlink network quality rating of the user in terms of the packet loss rate, average RTT, and jitter of the downlink network. See #QUALITY_TYPE.
  2321. */
  2322. virtual void onNetworkQuality(uid_t uid, int txQuality, int rxQuality) {
  2323. (void)uid;
  2324. (void)txQuality;
  2325. (void)rxQuality;
  2326. }
  2327. /** Reports the statistics of the local video streams.
  2328. *
  2329. * The SDK triggers this callback once every two seconds for each
  2330. * user/host. If there are multiple users/hosts in the channel, the SDK
  2331. * triggers this callback as many times.
  2332. *
  2333. * @note
  2334. * If you have called the \ref agora::rtc::IRtcEngine::enableDualStream
  2335. * "enableDualStream" method, the \ref onLocalVideoStats()
  2336. * "onLocalVideoStats" callback reports the statistics of the high-video
  2337. * stream (high bitrate, and high-resolution video stream).
  2338. *
  2339. * @param stats Statistics of the local video stream. See LocalVideoStats.
  2340. */
  2341. virtual void onLocalVideoStats(const LocalVideoStats& stats) {
  2342. (void)stats;
  2343. }
  2344. /** Reports the statistics of the video stream from each remote user/host.
  2345. *
  2346. * The SDK triggers this callback once every two seconds for each remote
  2347. * user/host. If a channel includes multiple remote users, the SDK
  2348. * triggers this callback as many times.
  2349. *
  2350. * @param stats Statistics of the remote video stream. See
  2351. * RemoteVideoStats.
  2352. */
  2353. virtual void onRemoteVideoStats(const RemoteVideoStats& stats) {
  2354. (void)stats;
  2355. }
  2356. /** Reports the statistics of the local audio stream.
  2357. *
  2358. * The SDK triggers this callback once every two seconds.
  2359. *
  2360. * @param stats The statistics of the local audio stream.
  2361. * See LocalAudioStats.
  2362. */
  2363. virtual void onLocalAudioStats(const LocalAudioStats& stats) {
  2364. (void)stats;
  2365. }
  2366. /** Reports the statistics of the audio stream from each remote user/host.
  2367. This callback replaces the \ref agora::rtc::IRtcEngineEventHandler::onAudioQuality "onAudioQuality" callback.
  2368. The SDK triggers this callback once every two seconds for each remote user/host. If a channel includes multiple remote users, the SDK triggers this callback as many times.
  2369. @param stats Pointer to the statistics of the received remote audio streams. See RemoteAudioStats.
  2370. */
  2371. virtual void onRemoteAudioStats(const RemoteAudioStats& stats) {
  2372. (void)stats;
  2373. }
  2374. /** Occurs when the local audio state changes.
  2375. *
  2376. * This callback indicates the state change of the local audio stream,
  2377. * including the state of the audio recording and encoding, and allows
  2378. * you to troubleshoot issues when exceptions occur.
  2379. *
  2380. * @note
  2381. * When the state is #LOCAL_AUDIO_STREAM_STATE_FAILED (3), see the `error`
  2382. * parameter for details.
  2383. *
  2384. * @param state State of the local audio. See #LOCAL_AUDIO_STREAM_STATE.
  2385. * @param error The error information of the local audio.
  2386. * See #LOCAL_AUDIO_STREAM_ERROR.
  2387. */
  2388. virtual void onLocalAudioStateChanged(LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error) {
  2389. (void)state;
  2390. (void)error;
  2391. }
  2392. /** Occurs when the remote audio state changes.
  2393. *
  2394. * This callback indicates the state change of the remote audio stream.
  2395. *
  2396. * @param uid ID of the remote user whose audio state changes.
  2397. * @param state State of the remote audio. See #REMOTE_AUDIO_STATE.
  2398. * @param reason The reason of the remote audio state change.
  2399. * See #REMOTE_AUDIO_STATE_REASON.
  2400. * @param elapsed Time elapsed (ms) from the local user calling the
  2401. * \ref IRtcEngine::joinChannel "joinChannel" method until the SDK
  2402. * triggers this callback.
  2403. */
  2404. virtual void onRemoteAudioStateChanged(uid_t uid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed) {
  2405. (void)uid;
  2406. (void)state;
  2407. (void)reason;
  2408. (void)elapsed;
  2409. }
  2410. /** Reports which users are speaking and the speakers' volume.
  2411. This callback reports the ID and volume of the loudest speakers at the moment in the channel.
  2412. This callback is disabled by default and can be enabled by the \ref IRtcEngine::enableAudioVolumeIndication "enableAudioVolumeIndication" method.
  2413. The local user has a dedicated *onAudioVolumeIndication* callback; all remote speakers share a separate *onAudioVolumeIndication* callback.
  2414. - For the local user's callback, the @p speakers array has @p uid = 0 and @p volume = @p totalVolume. @p speakerNumber = 1 whether or not the local user speaks.
  2415. - For the remote speakers' callback, the @p speakers array includes the user ID and volume of the loudest speakers in the channel.
  2416. The audio volume returned in this callback includes the voice volume and audio-mixing volume of the remote user.
  2417. @note
  2418. - Calling the \ref agora::rtc::IRtcEngine::muteLocalAudioStream "muteLocalAudioStream" method affects the SDK's behavior:
  2419. - If the local user calls the \ref agora::rtc::IRtcEngine::muteLocalAudioStream "muteLocalAudioStream" method, the SDK stops triggering the local user's callback.
  2420. - 15 seconds after a remote speaker calls the *muteLocalAudioStream* method, the remote speakers' callback excludes this remote user's information; 15 seconds after all remote users call the *muteLocalAudioStream* method, the SDK stops triggering the remote speakers' callback.
  2421. - An empty @p speakers array in the *onAudioVolumeIndication* callback suggests that no remote user is speaking at the moment.
  2422. @param speakers A pointer to AudioVolumeInfo, a struct containing each speaker's user ID and volume information.
  2423. @param speakerNumber Total number of speakers.
  2424. @param totalVolume Total volume after audio mixing. The value ranges between 0 (lowest volume) and 255 (highest volume).
  2425. */
  2426. virtual void onAudioVolumeIndication(const AudioVolumeInfo* speakers, unsigned int speakerNumber, int totalVolume) {
  2427. (void)speakers;
  2428. (void)speakerNumber;
  2429. (void)totalVolume;
  2430. }
  2431. /** Reports which user is the loudest speaker.
  2432. If the user enables the audio volume indication by calling the \ref IRtcEngine::enableAudioVolumeIndication "enableAudioVolumeIndication" method, this callback returns the @p uid of the active speaker detected by the audio volume detection module of the SDK.
  2433. @note
  2434. - To receive this callback, you need to call the \ref IRtcEngine::enableAudioVolumeIndication "enableAudioVolumeIndication" method.
  2435. - This callback returns the user ID of the user with the highest voice volume during a period of time, instead of at the moment.
  2436. @param uid User ID of the active speaker. A @p uid of 0 represents the local user.
  2437. */
  2438. virtual void onActiveSpeaker(uid_t uid) {
  2439. (void)uid;
  2440. }
  2441. /** **DEPRECATED** Occurs when the video stops playing.
  2442. The application can use this callback to change the configuration of the view (for example, displaying other pictures in the view) after the video stops playing.
  2443. Deprecated as of v2.4.1. Use LOCAL_VIDEO_STREAM_STATE_STOPPED(0) in the agora::rtc::IRtcEngineEventHandler::onLocalVideoStateChanged "onLocalVideoStateChanged" callback instead.
  2444. */
  2445. virtual void onVideoStopped() {}
  2446. /** Occurs when the engine receives and renders the first local video frame on the video window.
  2447. @param width Width (pixels) of the first local video frame.
  2448. @param height Height (pixels) of the first local video frame.
  2449. @param elapsed Time elapsed (ms) from the local user calling the \ref IRtcEngine::joinChannel "joinChannel" method until the SDK triggers this callback.
  2450. If you call the \ref IRtcEngine::startPreview "startPreview" method before calling the *joinChannel* method, then @p elapsed is the time elapsed from calling the *startPreview* method until the SDK triggers this callback.
  2451. */
  2452. virtual void onFirstLocalVideoFrame(int width, int height, int elapsed) {
  2453. (void)width;
  2454. (void)height;
  2455. (void)elapsed;
  2456. }
  2457. /** Occurs when the first remote video frame is received and decoded.
  2458. *
  2459. * @deprecated
  2460. * This callback is deprecated and replaced by the
  2461. * \ref onRemoteVideoStateChanged() "onRemoteVideoStateChanged" callback
  2462. * with the following parameters:
  2463. * - #REMOTE_VIDEO_STATE_STARTING (1)
  2464. * - #REMOTE_VIDEO_STATE_DECODING (2)
  2465. *
  2466. * This callback is triggered in either of the following scenarios:
  2467. *
  2468. * - The remote user joins the channel and sends the video stream.
  2469. * - The remote user stops sending the video stream and re-sends it after
  2470. * 15 seconds. Reasons for such an interruption include:
  2471. * - The remote user leaves the channel.
  2472. * - The remote user drops offline.
  2473. * - The remote user calls the
  2474. * \ref agora::rtc::IRtcEngine::muteLocalVideoStream "muteLocalVideoStream"
  2475. * method to stop sending the video stream.
  2476. * - The remote user calls the
  2477. * \ref agora::rtc::IRtcEngine::disableVideo "disableVideo" method to
  2478. * disable video.
  2479. *
  2480. * The application can configure the user view settings in this callback.
  2481. *
  2482. * @param uid User ID of the remote user sending the video stream.
  2483. * @param width Width (pixels) of the video stream.
  2484. * @param height Height (pixels) of the video stream.
  2485. * @param elapsed Time elapsed (ms) from the local user calling the
  2486. * \ref IRtcEngine::joinChannel "joinChannel" method until the SDK
  2487. * triggers this callback.
  2488. */
  2489. virtual void onFirstRemoteVideoDecoded(uid_t uid, int width, int height, int elapsed) {
  2490. (void)uid;
  2491. (void)width;
  2492. (void)height;
  2493. (void)elapsed;
  2494. }
  2495. /** Occurs when the first remote video frame is rendered.
  2496. The SDK triggers this callback when the first frame of the remote video is displayed in the user's video window. The application can retrieve the time elapsed from a user joining the channel until the first video frame is displayed.
  2497. @param uid User ID of the remote user sending the video stream.
  2498. @param width Width (pixels) of the video frame.
  2499. @param height Height (pixels) of the video stream.
  2500. @param elapsed Time elapsed (ms) from the local user calling the \ref IRtcEngine::joinChannel "joinChannel" method until the SDK triggers this callback.
  2501. */
  2502. virtual void onFirstRemoteVideoFrame(uid_t uid, int width, int height, int elapsed) {
  2503. (void)uid;
  2504. (void)width;
  2505. (void)height;
  2506. (void)elapsed;
  2507. }
  2508. /** Occurs when a remote user's audio stream is muted/unmuted.
  2509. The SDK triggers this callback when the remote user stops or resumes sending the audio stream by calling the \ref agora::rtc::IRtcEngine::muteLocalAudioStream "muteLocalAudioStream" method.
  2510. @note This callback returns invalid when the number of users in a channel exceeds 20.
  2511. @param uid User ID of the remote user.
  2512. @param muted Whether the remote user's audio stream is muted/unmuted:
  2513. - true: Muted.
  2514. - false: Unmuted.
  2515. */
  2516. virtual void onUserMuteAudio(uid_t uid, bool muted) {
  2517. (void)uid;
  2518. (void)muted;
  2519. }
  2520. /** Occurs when a remote user's video stream playback pauses/resumes.
  2521. *
  2522. * @deprecated
  2523. * This callback is deprecated and replaced by the
  2524. * \ref onRemoteVideoStateChanged() "onRemoteVideoStateChanged" callback
  2525. * with the following parameters:
  2526. * - #REMOTE_VIDEO_STATE_STOPPED (0) and
  2527. * #REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED (5).
  2528. * - #REMOTE_VIDEO_STATE_DECODING (2) and
  2529. * #REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED (6).
  2530. *
  2531. * The SDK triggers this callback when the remote user stops or resumes
  2532. * sending the video stream by calling the
  2533. * \ref agora::rtc::IRtcEngine::muteLocalVideoStream
  2534. * "muteLocalVideoStream" method.
  2535. *
  2536. * @note This callback returns invalid when the number of users in a
  2537. * channel exceeds 20.
  2538. *
  2539. * @param uid User ID of the remote user.
  2540. * @param muted Whether the remote user's video stream playback is
  2541. * paused/resumed:
  2542. * - true: Paused.
  2543. * - false: Resumed.
  2544. */
  2545. virtual void onUserMuteVideo(uid_t uid, bool muted) {
  2546. (void)uid;
  2547. (void)muted;
  2548. }
  2549. /** Occurs when a specific remote user enables/disables the video
  2550. * module.
  2551. *
  2552. * @deprecated
  2553. * This callback is deprecated and replaced by the
  2554. * \ref onRemoteVideoStateChanged() "onRemoteVideoStateChanged" callback
  2555. * with the following parameters:
  2556. * - #REMOTE_VIDEO_STATE_STOPPED (0) and
  2557. * #REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED (5).
  2558. * - #REMOTE_VIDEO_STATE_DECODING (2) and
  2559. * #REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED (6).
  2560. *
  2561. * Once the video module is disabled, the remote user can only use a
  2562. * voice call. The remote user cannot send or receive any video from
  2563. * other users.
  2564. *
  2565. * The SDK triggers this callback when the remote user enables or disables
  2566. * the video module by calling the
  2567. * \ref agora::rtc::IRtcEngine::enableVideo "enableVideo" or
  2568. * \ref agora::rtc::IRtcEngine::disableVideo "disableVideo" method.
  2569. *
  2570. * @note This callback returns invalid when the number of users in a
  2571. * channel exceeds 20.
  2572. *
  2573. * @param uid User ID of the remote user.
  2574. * @param enabled Whether the remote user enables/disables the video
  2575. * module:
  2576. * - true: Enable. The remote user can enter a video session.
  2577. * - false: Disable. The remote user can only enter a voice session, and
  2578. * cannot send or receive any video stream.
  2579. */
  2580. virtual void onUserEnableVideo(uid_t uid, bool enabled) {
  2581. (void)uid;
  2582. (void)enabled;
  2583. }
  2584. /** Occurs when the audio device state changes.
  2585. This callback notifies the application that the system's audio device state is changed. For example, a headset is unplugged from the device.
  2586. @param deviceId Pointer to the device ID.
  2587. @param deviceType Device type: #MEDIA_DEVICE_TYPE.
  2588. @param deviceState Device state: #MEDIA_DEVICE_STATE_TYPE.
  2589. */
  2590. virtual void onAudioDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) {
  2591. (void)deviceId;
  2592. (void)deviceType;
  2593. (void)deviceState;
  2594. }
  2595. /** Occurs when the volume of the playback device, microphone, or application changes.
  2596. @param deviceType Device type: #MEDIA_DEVICE_TYPE.
  2597. @param volume Volume of the device. The value ranges between 0 and 255.
  2598. @param muted
  2599. - true: The audio device is muted.
  2600. - false: The audio device is not muted.
  2601. */
  2602. virtual void onAudioDeviceVolumeChanged(MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) {
  2603. (void)deviceType;
  2604. (void)volume;
  2605. (void)muted;
  2606. }
  2607. /** **DEPRECATED** Occurs when the camera turns on and is ready to capture the video.
  2608. If the camera fails to turn on, fix the error reported in the \ref IRtcEngineEventHandler::onError "onError" callback.
  2609. Deprecated as of v2.4.1. Use LOCAL_VIDEO_STREAM_STATE_CAPTURING(1) in the agora::rtc::IRtcEngineEventHandler::onLocalVideoStateChanged "onLocalVideoStateChanged" callback instead.
  2610. */
  2611. virtual void onCameraReady() {}
  2612. /** Occurs when the camera focus area changes.
  2613. The SDK triggers this callback when the local user changes the camera focus position by calling the setCameraFocusPositionInPreview method.
  2614. @param x x coordinate of the changed camera focus area.
  2615. @param y y coordinate of the changed camera focus area.
  2616. @param width Width of the changed camera focus area.
  2617. @param height Height of the changed camera focus area.
  2618. */
  2619. virtual void onCameraFocusAreaChanged(int x, int y, int width, int height) {
  2620. (void)x;
  2621. (void)y;
  2622. (void)width;
  2623. (void)height;
  2624. }
  2625. /** Occurs when the camera exposure area changes.
  2626. The SDK triggers this callback when the local user changes the camera exposure position by calling the setCameraExposurePosition method.
  2627. @param x x coordinate of the changed camera exposure area.
  2628. @param y y coordinate of the changed camera exposure area.
  2629. @param width Width of the changed camera exposure area.
  2630. @param height Height of the changed camera exposure area.
  2631. */
  2632. virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
  2633. (void)x;
  2634. (void)y;
  2635. (void)width;
  2636. (void)height;
  2637. }
  2638. /** Occurs when the audio mixing file playback finishes.
  2639. **DEPRECATED** use onAudioMixingStateChanged instead.
  2640. You can start an audio mixing file playback by calling the \ref IRtcEngine::startAudioMixing "startAudioMixing" method. The SDK triggers this callback when the audio mixing file playback finishes.
  2641. If the *startAudioMixing* method call fails, an error code returns in the \ref IRtcEngineEventHandler::onError "onError" callback.
  2642. */
  2643. virtual void onAudioMixingFinished() {
  2644. }
  2645. /** Occurs when the state of the local user's audio mixing file changes.
  2646. - When the audio mixing file plays, pauses playing, or stops playing, this callback returns 710, 711, or 713 in @p state, and 0 in @p errorCode.
  2647. - When exceptions occur during playback, this callback returns 714 in @p state and an error in @p errorCode.
  2648. - If the local audio mixing file does not exist, or if the SDK does not support the file format or cannot access the music file URL, the SDK returns WARN_AUDIO_MIXING_OPEN_ERROR = 701.
  2649. @param state The state code. See #AUDIO_MIXING_STATE_TYPE.
  2650. @param errorCode The error code. See #AUDIO_MIXING_ERROR_TYPE.
  2651. */
  2652. virtual void onAudioMixingStateChanged(AUDIO_MIXING_STATE_TYPE state, AUDIO_MIXING_ERROR_TYPE errorCode){
  2653. }
  2654. /** Occurs when a remote user starts audio mixing.
  2655. When a remote user calls \ref IRtcEngine::startAudioMixing "startAudioMixing" to play the background music, the SDK reports this callback.
  2656. */
  2657. virtual void onRemoteAudioMixingBegin() {
  2658. }
  2659. /** Occurs when a remote user finishes audio mixing.
  2660. */
  2661. virtual void onRemoteAudioMixingEnd() {
  2662. }
  2663. /** Occurs when the local audio effect playback finishes.
  2664. The SDK triggers this callback when the local audio effect file playback finishes.
  2665. @param soundId ID of the local audio effect. Each local audio effect has a unique ID.
  2666. */
  2667. virtual void onAudioEffectFinished(int soundId) {
  2668. }
  2669. /**
  2670. Occurs when the SDK decodes the first remote audio frame for playback.
  2671. This callback is triggered in either of the following scenarios:
  2672. - The remote user joins the channel and sends the audio stream.
  2673. - The remote user stops sending the audio stream and re-sends it after 15 seconds. Reasons for such an interruption include:
  2674. - The remote user leaves channel.
  2675. - The remote user drops offline.
  2676. - The remote user calls the \ref agora::rtc::IRtcEngine::muteLocalAudioStream "muteLocalAudioStream" method to stop sending the local audio stream.
  2677. - The remote user calls the \ref agora::rtc::IRtcEngine::disableAudio "disableAudio" method to disable audio.
  2678. @param uid User ID of the remote user sending the audio stream.
  2679. @param elapsed Time elapsed (ms) from the local user calling the \ref IRtcEngine::joinChannel "joinChannel" method until the SDK triggers this callback.
  2680. */
  2681. virtual void onFirstRemoteAudioDecoded(uid_t uid, int elapsed) {
  2682. (void)uid;
  2683. (void)elapsed;
  2684. }
  2685. /** Occurs when the video device state changes.
  2686. @note On a Windows device with an external camera for video capturing, the video disables once the external camera is unplugged.
  2687. @param deviceId Pointer to the device ID of the video device that changes state.
  2688. @param deviceType Device type: #MEDIA_DEVICE_TYPE.
  2689. @param deviceState Device state: #MEDIA_DEVICE_STATE_TYPE.
  2690. */
  2691. virtual void onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) {
  2692. (void)deviceId;
  2693. (void)deviceType;
  2694. (void)deviceState;
  2695. }
  2696. /** Occurs when the local video stream state changes.
  2697. @note This callback indicates the state of the local video stream, including camera capturing and video encoding, and allows you to troubleshoot issues when exceptions occur.
  2698. @param localVideoState State type #LOCAL_VIDEO_STREAM_STATE. When the state is LOCAL_VIDEO_STREAM_STATE_FAILED (3), see the *error* parameter for details.
  2699. @param error The detailed error information. code #LOCAL_VIDEO_STREAM_ERROR.
  2700. */
  2701. virtual void onLocalVideoStateChanged(LOCAL_VIDEO_STREAM_STATE localVideoState, LOCAL_VIDEO_STREAM_ERROR error) {
  2702. (void)localVideoState;
  2703. (void)error;
  2704. }
  2705. /** Occurs when the video size or rotation of a specified user changes.
  2706. @param uid User ID of the remote user or local user (0) whose video size or rotation changes.
  2707. @param width New width (pixels) of the video.
  2708. @param height New height (pixels) of the video.
  2709. @param rotation New rotation of the video [0 to 360).
  2710. */
  2711. virtual void onVideoSizeChanged(uid_t uid, int width, int height, int rotation) {
  2712. (void)uid;
  2713. (void)width;
  2714. (void)height;
  2715. (void)rotation;
  2716. }
  2717. /** Occurs when the remote video state changes.
  2718. *
  2719. * @param uid ID of the remote user whose video state changes.
  2720. * @param state State of the remote video. See #REMOTE_VIDEO_STATE.
  2721. * @param reason The reason of the remote video state change. See
  2722. * #REMOTE_VIDEO_STATE_REASON.
  2723. * @param elapsed Time elapsed (ms) from the local user calling the
  2724. * \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method until the
  2725. * SDK triggers this callback.
  2726. */
  2727. virtual void onRemoteVideoStateChanged(uid_t uid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) {
  2728. (void)uid;
  2729. (void)state;
  2730. (void)reason;
  2731. (void)elapsed;
  2732. }
  2733. /** Occurs when a specified remote user enables/disables the local video
  2734. * capturing function.
  2735. *
  2736. * @deprecated
  2737. * This callback is deprecated and replaced by the
  2738. * \ref onRemoteVideoStateChanged() "onRemoteVideoStateChanged" callback
  2739. * with the following parameters:
  2740. * - #REMOTE_VIDEO_STATE_STOPPED (0) and
  2741. * #REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED (5).
  2742. * - #REMOTE_VIDEO_STATE_DECODING (2) and
  2743. * #REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED (6).
  2744. *
  2745. * This callback is only applicable to the scenario when the user only
  2746. * wants to watch the remote video without sending any video stream to the
  2747. * other user.
  2748. *
  2749. * The SDK triggers this callback when the remote user resumes or stops
  2750. * capturing the video stream by calling the
  2751. * \ref agora::rtc::IRtcEngine::enableLocalVideo "enableLocalVideo" method.
  2752. *
  2753. * @param uid User ID of the remote user.
  2754. * @param enabled Whether the specified remote user enables/disables the
  2755. * local video capturing function:
  2756. * - true: Enable. Other users in the channel can see the video of this
  2757. * remote user.
  2758. * - false: Disable. Other users in the channel can no longer receive the
  2759. * video stream from this remote user, while this remote user can still
  2760. * receive the video streams from other users.
  2761. */
  2762. virtual void onUserEnableLocalVideo(uid_t uid, bool enabled) {
  2763. (void)uid;
  2764. (void)enabled;
  2765. }
  2766. // virtual void onStreamError(int streamId, int code, int parameter, const char* message, size_t length) {}
  2767. /** Occurs when the local user receives the data stream from the remote user within five seconds.
  2768. The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method.
  2769. @param uid User ID of the remote user sending the message.
  2770. @param streamId Stream ID.
  2771. @param data Pointer to the data received by the local user.
  2772. @param length Length of the data in bytes.
  2773. */
  2774. virtual void onStreamMessage(uid_t uid, int streamId, const char* data, size_t length) {
  2775. (void)uid;
  2776. (void)streamId;
  2777. (void)data;
  2778. (void)length;
  2779. }
  2780. /** Occurs when the local user does not receive the data stream from the remote user within five seconds.
  2781. The SDK triggers this callback when the local user fails to receive the stream message that the remote user sends by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method.
  2782. @param uid User ID of the remote user sending the message.
  2783. @param streamId Stream ID.
  2784. @param code Error code: #ERROR_CODE_TYPE.
  2785. @param missed Number of lost messages.
  2786. @param cached Number of incoming cached messages when the data stream is interrupted.
  2787. */
  2788. virtual void onStreamMessageError(uid_t uid, int streamId, int code, int missed, int cached) {
  2789. (void)uid;
  2790. (void)streamId;
  2791. (void)code;
  2792. (void)missed;
  2793. (void)cached;
  2794. }
  2795. /** Occurs when the media engine loads.*/
  2796. virtual void onMediaEngineLoadSuccess() {
  2797. }
  2798. /** Occurs when the media engine call starts.*/
  2799. virtual void onMediaEngineStartCallSuccess() {
  2800. }
  2801. /** Occurs when the state of the media stream relay changes.
  2802. *
  2803. * The SDK returns the state of the current media relay with any error
  2804. * message.
  2805. *
  2806. * @param state The state code in #CHANNEL_MEDIA_RELAY_STATE.
  2807. * @param code The error code in #CHANNEL_MEDIA_RELAY_ERROR.
  2808. */
  2809. virtual void onChannelMediaRelayStateChanged(CHANNEL_MEDIA_RELAY_STATE state,CHANNEL_MEDIA_RELAY_ERROR code) {
  2810. }
  2811. /** Reports events during the media stream relay.
  2812. *
  2813. * @param code The event code in #CHANNEL_MEDIA_RELAY_EVENT.
  2814. */
  2815. virtual void onChannelMediaRelayEvent(CHANNEL_MEDIA_RELAY_EVENT code) {
  2816. }
  2817. /** Occurs when the engine sends the first local audio frame.
  2818. @param elapsed Time elapsed (ms) from the local user calling \ref IRtcEngine::joinChannel "joinChannel" until the SDK triggers this callback.
  2819. */
  2820. virtual void onFirstLocalAudioFrame(int elapsed) {
  2821. (void)elapsed;
  2822. }
  2823. /** Occurs when the engine receives the first audio frame from a specific remote user.
  2824. @param uid User ID of the remote user.
  2825. @param elapsed Time elapsed (ms) from the remote user calling \ref IRtcEngine::joinChannel "joinChannel" until the SDK triggers this callback.
  2826. */
  2827. virtual void onFirstRemoteAudioFrame(uid_t uid, int elapsed) {
  2828. (void)uid;
  2829. (void)elapsed;
  2830. }
  2831. /**
  2832. Occurs when the state of the RTMP streaming changes.
  2833. The SDK triggers this callback to report the result of the local user calling the \ref agora::rtc::IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" or \ref agora::rtc::IRtcEngine::removePublishStreamUrl "removePublishStreamUrl" method.
  2834. This callback indicates the state of the RTMP streaming. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the *errCode* parameter.
  2835. @param url The RTMP URL address.
  2836. @param state The RTMP streaming state. See: #RTMP_STREAM_PUBLISH_STATE.
  2837. @param errCode The detailed error information for streaming. See: #RTMP_STREAM_PUBLISH_ERROR.
  2838. */
  2839. virtual void onRtmpStreamingStateChanged(const char *url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_ERROR errCode) {
  2840. (void) url;
  2841. (RTMP_STREAM_PUBLISH_STATE) state;
  2842. (RTMP_STREAM_PUBLISH_ERROR) errCode;
  2843. }
  2844. /** Reports the result of calling the \ref IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" method. (CDN live only.)
  2845. @param url The RTMP URL address.
  2846. @param error Error code: #ERROR_CODE_TYPE. Main errors include:
  2847. - #ERR_OK (0): The publishing succeeds.
  2848. - #ERR_FAILED (1): The publishing fails.
  2849. - #ERR_INVALID_ARGUMENT (2): Invalid argument used. If, for example, you did not call \ref agora::rtc::IRtcEngine::setLiveTranscoding "setLiveTranscoding" to configure LiveTranscoding before calling \ref agora::rtc::IRtcEngine::addPublishStreamUrl "addPublishStreamUrl", the SDK reports #ERR_INVALID_ARGUMENT.
  2850. - #ERR_TIMEDOUT (10): The publishing timed out.
  2851. - #ERR_ALREADY_IN_USE (19): The chosen URL address is already in use for CDN live streaming.
  2852. - #ERR_RESOURCE_LIMITED (22): The backend system does not have enough resources for the CDN live streaming.
  2853. - #ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISH (130): You cannot publish an encrypted stream.
  2854. - #ERR_PUBLISH_STREAM_CDN_ERROR (151)
  2855. - #ERR_PUBLISH_STREAM_NUM_REACH_LIMIT (152)
  2856. - #ERR_PUBLISH_STREAM_NOT_AUTHORIZED (153)
  2857. - #ERR_PUBLISH_STREAM_INTERNAL_SERVER_ERROR (154)
  2858. - #ERR_PUBLISH_STREAM_FORMAT_NOT_SUPPORTED (156)
  2859. */
  2860. virtual void onStreamPublished(const char *url, int error) {
  2861. (void)url;
  2862. (void)error;
  2863. }
  2864. /** Reports the result of calling the \ref agora::rtc::IRtcEngine::removePublishStreamUrl "removePublishStreamUrl" method. (CDN live only.)
  2865. This callback indicates whether you have successfully removed an RTMP stream from the CDN.
  2866. @param url The RTMP URL address.
  2867. */
  2868. virtual void onStreamUnpublished(const char *url) {
  2869. (void)url;
  2870. }
  2871. /** Occurs when the publisher's transcoding is updated. */
  2872. virtual void onTranscodingUpdated() {
  2873. }
  2874. /** Occurs when a voice or video stream URL address is added to a live broadcast.
  2875. @param url Pointer to the URL address of the externally injected stream.
  2876. @param uid User ID.
  2877. @param status State of the externally injected stream: #INJECT_STREAM_STATUS.
  2878. */
  2879. virtual void onStreamInjectedStatus(const char* url, uid_t uid, int status) {
  2880. (void)url;
  2881. (void)uid;
  2882. (void)status;
  2883. }
  2884. /** Occurs when the local audio route changes.
  2885. The SDK triggers this callback when the local audio route switches to an earpiece, speakerphone, headset, or Bluetooth device.
  2886. @note This callback is for Android and iOS only.
  2887. @param routing Audio output routing. See: #AUDIO_ROUTE_TYPE.
  2888. */
  2889. virtual void onAudioRouteChanged(AUDIO_ROUTE_TYPE routing) {
  2890. (void)routing;
  2891. }
  2892. /** Occurs when the locally published media stream falls back to an audio-only stream due to poor network conditions or switches back to the video after the network conditions improve.
  2893. If you call \ref IRtcEngine::setLocalPublishFallbackOption "setLocalPublishFallbackOption" and set *option* as #STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK triggers this callback when the locally published stream falls back to audio-only mode due to poor uplink conditions, or when the audio stream switches back to the video after the uplink network condition improves.
  2894. @param isFallbackOrRecover Whether the locally published stream falls back to audio-only or switches back to the video:
  2895. - true: The locally published stream falls back to audio-only due to poor network conditions.
  2896. - false: The locally published stream switches back to the video after the network conditions improve.
  2897. */
  2898. virtual void onLocalPublishFallbackToAudioOnly(bool isFallbackOrRecover) {
  2899. (void)isFallbackOrRecover;
  2900. }
  2901. /** Occurs when the remote media stream falls back to audio-only stream
  2902. * due to poor network conditions or switches back to the video stream
  2903. * after the network conditions improve.
  2904. *
  2905. * If you call
  2906. * \ref IRtcEngine::setRemoteSubscribeFallbackOption
  2907. * "setRemoteSubscribeFallbackOption" and set
  2908. * @p option as #STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK triggers this
  2909. * callback when the remote media stream falls back to audio-only mode due
  2910. * to poor uplink conditions, or when the remote media stream switches
  2911. * back to the video after the uplink network condition improves.
  2912. *
  2913. * @note Once the remote media stream switches to the low stream due to
  2914. * poor network conditions, you can monitor the stream switch between a
  2915. * high and low stream in the RemoteVideoStats callback.
  2916. *
  2917. * @param uid ID of the remote user sending the stream.
  2918. * @param isFallbackOrRecover Whether the remotely subscribed media stream
  2919. * falls back to audio-only or switches back to the video:
  2920. * - true: The remotely subscribed media stream falls back to audio-only
  2921. * due to poor network conditions.
  2922. * - false: The remotely subscribed media stream switches back to the
  2923. * video stream after the network conditions improved.
  2924. */
  2925. virtual void onRemoteSubscribeFallbackToAudioOnly(uid_t uid, bool isFallbackOrRecover) {
  2926. (void)uid;
  2927. (void)isFallbackOrRecover;
  2928. }
  2929. /** Reports the transport-layer statistics of each remote audio stream.
  2930. *
  2931. * @deprecated
  2932. * This callback is deprecated and replaced by the
  2933. * \ref onRemoteAudioStats() "onRemoteAudioStats" callback.
  2934. *
  2935. * This callback reports the transport-layer statistics, such as the
  2936. * packet loss rate and network time delay, once every two seconds after
  2937. * the local user receives an audio packet from a remote user.
  2938. *
  2939. * @param uid User ID of the remote user sending the audio packet.
  2940. * @param delay Network time delay (ms) from the remote user sending the
  2941. * audio packet to the local user.
  2942. * @param lost Packet loss rate (%) of the audio packet sent from the
  2943. * remote user.
  2944. * @param rxKBitRate Received bitrate (Kbps) of the audio packet sent
  2945. * from the remote user.
  2946. */
  2947. virtual void onRemoteAudioTransportStats(
  2948. uid_t uid, unsigned short delay, unsigned short lost,
  2949. unsigned short rxKBitRate) {
  2950. (void)uid;
  2951. (void)delay;
  2952. (void)lost;
  2953. (void)rxKBitRate;
  2954. }
  2955. /** Reports the transport-layer statistics of each remote video stream.
  2956. *
  2957. * @deprecated
  2958. * This callback is deprecated and replaced by the
  2959. * \ref onRemoteVideoStats() "onRemoteVideoStats" callback.
  2960. *
  2961. * This callback reports the transport-layer statistics, such as the
  2962. * packet loss rate and network time delay, once every two seconds after
  2963. * the local user receives a video packet from a remote user.
  2964. *
  2965. * @param uid User ID of the remote user sending the video packet.
  2966. * @param delay Network time delay (ms) from the remote user sending the
  2967. * video packet to the local user.
  2968. * @param lost Packet loss rate (%) of the video packet sent from the
  2969. * remote user.
  2970. * @param rxKBitRate Received bitrate (Kbps) of the video packet sent
  2971. * from the remote user.
  2972. */
  2973. virtual void onRemoteVideoTransportStats(
  2974. uid_t uid, unsigned short delay, unsigned short lost,
  2975. unsigned short rxKBitRate) {
  2976. (void)uid;
  2977. (void)delay;
  2978. (void)lost;
  2979. (void)rxKBitRate;
  2980. }
  2981. /** **DEPRECATED** Occurs when the microphone is enabled/disabled.
  2982. *
  2983. * The \ref onMicrophoneEnabled() "onMicrophoneEnabled" callback is
  2984. * deprecated. Use #LOCAL_AUDIO_STREAM_STATE_STOPPED (0) or
  2985. * #LOCAL_AUDIO_STREAM_STATE_RECORDING (1) in the
  2986. * \ref onLocalAudioStateChanged() "onLocalAudioStateChanged" callback
  2987. * instead.
  2988. *
  2989. * The SDK triggers this callback when the local user resumes or stops
  2990. * capturing the local audio stream by calling the
  2991. * \ref agora::rtc::IRtcEngine::enableLocalAudio "enbaleLocalAudio" method.
  2992. *
  2993. * @param enabled Whether the microphone is enabled/disabled:
  2994. * - true: Enabled.
  2995. * - false: Disabled.
  2996. */
  2997. virtual void onMicrophoneEnabled(bool enabled) {
  2998. (void)enabled;
  2999. }
  3000. /** Occurs when the connection state between the SDK and the server changes.
  3001. @param state See #CONNECTION_STATE_TYPE.
  3002. @param reason See #CONNECTION_CHANGED_REASON_TYPE.
  3003. */
  3004. virtual void onConnectionStateChanged(
  3005. CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason) {
  3006. (void)state;
  3007. (void)reason;
  3008. }
  3009. /** Occurs when the local network type changes.
  3010. When the network connection is interrupted, this callback indicates whether the interruption is caused by a network type change or poor network conditions.
  3011. @param type See #NETWORK_TYPE.
  3012. */
  3013. virtual void onNetworkTypeChanged(NETWORK_TYPE type) {
  3014. (void)type;
  3015. }
  3016. /** Occurs when the local user successfully registers a user account by calling the \ref agora::rtc::IRtcEngine::registerLocalUserAccount "registerLocalUserAccount" method or joins a channel by calling the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method.This callback reports the user ID and user account of the local user.
  3017. @param uid The ID of the local user.
  3018. @param userAccount The user account of the local user.
  3019. */
  3020. virtual void onLocalUserRegistered(uid_t uid, const char* userAccount) {
  3021. (void)uid;
  3022. (void)userAccount;
  3023. }
  3024. /** Occurs when the SDK gets the user ID and user account of the remote user.
  3025. After a remote user joins the channel, the SDK gets the UID and user account of the remote user,
  3026. caches them in a mapping table object (`userInfo`), and triggers this callback on the local client.
  3027. @param uid The ID of the remote user.
  3028. @param info The `UserInfo` object that contains the user ID and user account of the remote user.
  3029. */
  3030. virtual void onUserInfoUpdated(uid_t uid, const UserInfo& info) {
  3031. (void)uid;
  3032. (void)info;
  3033. }
  3034. };
  3035. /**
  3036. * Video device collection methods.
  3037. The IVideoDeviceCollection interface class retrieves the video device information.
  3038. */
  3039. class IVideoDeviceCollection
  3040. {
  3041. protected:
  3042. virtual ~IVideoDeviceCollection(){}
  3043. public:
  3044. /** Retrieves the total number of the indexed video devices in the system.
  3045. @return Total number of the indexed video devices:
  3046. */
  3047. virtual int getCount() = 0;
  3048. /** Retrieves a specified piece of information about an indexed video device.
  3049. @param index The specified index of the video device that must be less than the return value of \ref IVideoDeviceCollection::getCount "getCount".
  3050. @param deviceName Pointer to the video device name.
  3051. @param deviceId Pointer to the video device ID.
  3052. @return
  3053. - 0: Success.
  3054. - < 0: Failure.
  3055. */
  3056. virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3057. /** Sets the device with the device ID.
  3058. @param deviceId Device ID of the device.
  3059. @return
  3060. - 0: Success.
  3061. - < 0: Failure.
  3062. */
  3063. virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3064. /** Releases all IVideoDeviceCollection resources.
  3065. */
  3066. virtual void release() = 0;
  3067. };
  3068. /** Video device management methods.
  3069. The IVideoDeviceManager interface class tests the video device interfaces. Instantiate an AVideoDeviceManager class to retrieve an IVideoDeviceManager interface.
  3070. */
  3071. class IVideoDeviceManager
  3072. {
  3073. protected:
  3074. virtual ~IVideoDeviceManager(){}
  3075. public:
  3076. /** Enumerates the video devices.
  3077. This method returns an IVideoDeviceCollection object including all video devices in the system. With the IVideoDeviceCollection object, the application can enumerate the video devices. The application must call the \ref IVideoDeviceCollection::release "release" method to release the returned object after using it.
  3078. @return
  3079. - An IVideoDeviceCollection object including all video devices in the system: Success.
  3080. - NULL: Failure.
  3081. */
  3082. virtual IVideoDeviceCollection* enumerateVideoDevices() = 0;
  3083. /** Starts the video-capture device test.
  3084. This method tests whether the video-capture device works properly. Before calling this method, ensure that you have already called the \ref IRtcEngine::enableVideo "enableVideo" method, and the window handle (*hwnd*) parameter is valid.
  3085. @param hwnd The window handle used to display the screen.
  3086. @return
  3087. - 0: Success.
  3088. - < 0: Failure.
  3089. */
  3090. virtual int startDeviceTest(view_t hwnd) = 0;
  3091. /** Stops the video-capture device test.
  3092. @return
  3093. - 0: Success.
  3094. - < 0: Failure.
  3095. */
  3096. virtual int stopDeviceTest() = 0;
  3097. /** Sets a device with the device ID.
  3098. @param deviceId Pointer to the video-capture device ID. Call the \ref IVideoDeviceManager::enumerateVideoDevices "enumerateVideoDevices" method to retrieve it.
  3099. @note Plugging or unplugging the device does not change the device ID.
  3100. @return
  3101. - 0: Success.
  3102. - < 0: Failure.
  3103. */
  3104. virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3105. /** Retrieves the video-capture device that is in use.
  3106. @param deviceId Pointer to the video-capture device ID.
  3107. @return
  3108. - 0: Success.
  3109. - < 0: Failure.
  3110. */
  3111. virtual int getDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3112. /** Releases all IVideoDeviceManager resources.
  3113. */
  3114. virtual void release() = 0;
  3115. };
  3116. /** Audio device collection methods.
  3117. The IAudioDeviceCollection interface class retrieves device-related information.
  3118. */
  3119. class IAudioDeviceCollection
  3120. {
  3121. protected:
  3122. virtual ~IAudioDeviceCollection(){}
  3123. public:
  3124. /** Retrieves the total number of audio playback or audio recording devices.
  3125. @note You must first call the \ref IAudioDeviceManager::enumeratePlaybackDevices "enumeratePlaybackDevices" or \ref IAudioDeviceManager::enumerateRecordingDevices "enumerateRecordingDevices" method before calling this method to return the number of audio playback or audio recording devices.
  3126. @return Number of audio playback or audio recording devices.
  3127. */
  3128. virtual int getCount() = 0;
  3129. /** Retrieves a specified piece of information about an indexed audio device.
  3130. @param index The specified index that must be less than the return value of \ref IAudioDeviceCollection::getCount "getCount".
  3131. @param deviceName Pointer to the audio device name.
  3132. @param deviceId Pointer to the audio device ID.
  3133. @return
  3134. - 0: Success.
  3135. - < 0: Failure.
  3136. */
  3137. virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3138. /** Specifies a device with the device ID.
  3139. @param deviceId Pointer to the device ID of the device.
  3140. @return
  3141. - 0: Success.
  3142. - < 0: Failure.
  3143. */
  3144. virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3145. /** Sets the volume of the application.
  3146. @param volume Application volume. The value ranges between 0 (lowest volume) and 255 (highest volume).
  3147. @return
  3148. - 0: Success.
  3149. - < 0: Failure.
  3150. */
  3151. virtual int setApplicationVolume(int volume) = 0;
  3152. /** Retrieves the volume of the application.
  3153. @param volume Pointer to the application volume. The volume value ranges between 0 (lowest volume) and 255 (highest volume).
  3154. @return
  3155. - 0: Success.
  3156. - < 0: Failure.
  3157. */
  3158. virtual int getApplicationVolume(int& volume) = 0;
  3159. /** Mutes the application.
  3160. @param mute Sets whether to mute/unmute the application:
  3161. - true: Mute the application.
  3162. - false: Unmute the application.
  3163. @return
  3164. - 0: Success.
  3165. - < 0: Failure.
  3166. */
  3167. virtual int setApplicationMute(bool mute) = 0;
  3168. /** Retrieves the mute status of the application.
  3169. @param mute Pointer to whether the application is muted/unmuted.
  3170. - true: The application is muted.
  3171. - false: The application is not muted.
  3172. @return
  3173. - 0: Success.
  3174. - < 0: Failure.
  3175. */
  3176. virtual int isApplicationMute(bool& mute) = 0;
  3177. /** Releases all IAudioDeviceCollection resources.
  3178. */
  3179. virtual void release() = 0;
  3180. };
  3181. /** Audio device management methods.
  3182. The IAudioDeviceManager interface class allows for audio device interface testing. Instantiate an AAudioDeviceManager class to retrieve the IAudioDeviceManager interface.
  3183. */
  3184. class IAudioDeviceManager
  3185. {
  3186. protected:
  3187. virtual ~IAudioDeviceManager(){}
  3188. public:
  3189. /** Enumerates the audio playback devices.
  3190. This method returns an IAudioDeviceCollection object that includes all audio playback devices in the system. With the IAudioDeviceCollection object, the application can enumerate the audio playback devices.
  3191. @note The application must call the \ref IAudioDeviceCollection::release "release" method to release the returned object after using it.
  3192. @return
  3193. - Success: Returns an IAudioDeviceCollection object that includes all audio playback devices in the system. For wireless Bluetooth headset devices with master and slave headsets, the master headset is the playback device.
  3194. - Returns NULL: Failure.
  3195. */
  3196. virtual IAudioDeviceCollection* enumeratePlaybackDevices() = 0;
  3197. /** Enumerates the audio recording devices.
  3198. This method returns an IAudioDeviceCollection object that includes all audio recording devices in the system. With the IAudioDeviceCollection object, the application can enumerate the audio recording devices.
  3199. @note The application needs to call the \ref IAudioDeviceCollection::release "release" method to release the returned object after using it.
  3200. @return
  3201. - Returns an IAudioDeviceCollection object that includes all audio recording devices in the system: Success.
  3202. - Returns NULL: Failure.
  3203. */
  3204. virtual IAudioDeviceCollection* enumerateRecordingDevices() = 0;
  3205. /** Sets the audio playback device using the device ID.
  3206. @note Plugging or unplugging the audio device does not change the device ID.
  3207. @param deviceId Device ID of the audio playback device, retrieved by calling the \ref IAudioDeviceManager::enumeratePlaybackDevices "enumeratePlaybackDevices" method.
  3208. @return
  3209. - 0: Success.
  3210. - < 0: Failure.
  3211. */
  3212. virtual int setPlaybackDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3213. /** Sets the audio recording device using the device ID.
  3214. @param deviceId Device ID of the audio recording device, retrieved by calling the \ref IAudioDeviceManager::enumerateRecordingDevices "enumerateRecordingDevices" method.
  3215. @note Plugging or unplugging the audio device does not change the device ID.
  3216. @return
  3217. - 0: Success.
  3218. - < 0: Failure.
  3219. */
  3220. virtual int setRecordingDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3221. /** Starts the audio playback device test.
  3222. This method tests if the playback device works properly. In the test, the SDK plays an audio file specified by the user. If the user can hear the audio, the playback device works properly.
  3223. @param testAudioFilePath Pointer to the path of the audio file for the audio playback device test in UTF-8:
  3224. - Supported file formats: wav, mp3, m4a, and aac.
  3225. - Supported file sample rates: 8000, 16000, 32000, 44100, and 48000 Hz.
  3226. @return
  3227. - 0: Success, and you can hear the sound of the specified audio file.
  3228. - < 0: Failure.
  3229. */
  3230. virtual int startPlaybackDeviceTest(const char* testAudioFilePath) = 0;
  3231. /** Stops the audio playback device test.
  3232. This method stops testing the audio playback device. You must call this method to stop the test after calling the \ref IAudioDeviceManager::startPlaybackDeviceTest "startPlaybackDeviceTest" method.
  3233. @return
  3234. - 0: Success.
  3235. - < 0: Failure.
  3236. */
  3237. virtual int stopPlaybackDeviceTest() = 0;
  3238. /** Sets the volume of the audio playback device.
  3239. @param volume Sets the volume of the audio playback device. The value ranges between 0 (lowest volume) and 255 (highest volume).
  3240. @return
  3241. - 0: Success.
  3242. - < 0: Failure.
  3243. */
  3244. virtual int setPlaybackDeviceVolume(int volume) = 0;
  3245. /** Retrieves the volume of the audio playback device.
  3246. @param volume Pointer to the audio playback device volume. The volume value ranges between 0 (lowest volume) and 255 (highest volume).
  3247. @return
  3248. - 0: Success.
  3249. - < 0: Failure.
  3250. */
  3251. virtual int getPlaybackDeviceVolume(int *volume) = 0;
  3252. /** Sets the volume of the microphone.
  3253. @param volume Sets the volume of the microphone. The value ranges between 0 (lowest volume) and 255 (highest volume).
  3254. @return
  3255. - 0: Success.
  3256. - < 0: Failure.
  3257. */
  3258. virtual int setRecordingDeviceVolume(int volume) = 0;
  3259. /** Retrieves the volume of the microphone.
  3260. @param volume Pointer to the microphone volume. The volume value ranges between 0 (lowest volume) and 255 (highest volume).
  3261. @return
  3262. - 0: Success.
  3263. - < 0: Failure.
  3264. */
  3265. virtual int getRecordingDeviceVolume(int *volume) = 0;
  3266. /** Mutes the audio playback device.
  3267. @param mute Sets whether to mute/unmute the audio playback device:
  3268. - true: Mutes.
  3269. - false: Unmutes.
  3270. @return
  3271. - 0: Success.
  3272. - < 0: Failure.
  3273. */
  3274. virtual int setPlaybackDeviceMute(bool mute) = 0;
  3275. /** Retrieves the mute status of the audio playback device.
  3276. @param mute Pointer to whether the audio playback device is muted/unmuted.
  3277. - true: Muted.
  3278. - false: Unmuted.
  3279. @return
  3280. - 0: Success.
  3281. - < 0: Failure.
  3282. */
  3283. virtual int getPlaybackDeviceMute(bool *mute) = 0;
  3284. /** Mutes/Unmutes the microphone.
  3285. @param mute Sets whether to mute/unmute the microphone:
  3286. - true: Mutes.
  3287. - false: Unmutes.
  3288. @return
  3289. - 0: Success.
  3290. - < 0: Failure.
  3291. */
  3292. virtual int setRecordingDeviceMute(bool mute) = 0;
  3293. /** Retrieves the microphone's mute status.
  3294. @param mute Pointer to whether the microphone is muted/unmuted.
  3295. - true: Muted.
  3296. - false: Unmuted.
  3297. @return
  3298. - 0: Success.
  3299. - < 0: Failure.
  3300. */
  3301. virtual int getRecordingDeviceMute(bool *mute) = 0;
  3302. /** Starts the microphone test.
  3303. This method tests whether the microphone works properly. Once the test starts, the SDK uses the \ref IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" callback to notify the application with the volume information.
  3304. @param indicationInterval Interval period (ms) of the \ref IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" callback cycle.
  3305. @return
  3306. - 0: Success.
  3307. - < 0: Failure.
  3308. */
  3309. virtual int startRecordingDeviceTest(int indicationInterval) = 0;
  3310. /** Stops the microphone test.
  3311. This method stops the microphone test. You must call this method to stop the test after calling the \ref IAudioDeviceManager::startRecordingDeviceTest "startRecordingDeviceTest" method.
  3312. @return
  3313. - 0: Success.
  3314. - < 0: Failure.
  3315. */
  3316. virtual int stopRecordingDeviceTest() = 0;
  3317. /** Retrieves the audio playback device associated with the device ID.
  3318. @param deviceId Pointer to the ID of the audio playback device.
  3319. @return
  3320. - 0: Success.
  3321. - < 0: Failure.
  3322. */
  3323. virtual int getPlaybackDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3324. /** Retrieves the audio playback device information associated with the device ID and device name.
  3325. @param deviceId Pointer to the device ID of the audio playback device.
  3326. @param deviceName Pointer to the device name of the audio playback device.
  3327. @return
  3328. - 0: Success.
  3329. - < 0: Failure.
  3330. */
  3331. virtual int getPlaybackDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], char deviceName[MAX_DEVICE_ID_LENGTH]) = 0;
  3332. /** Retrieves the audio recording device associated with the device ID.
  3333. @param deviceId Pointer to the device ID of the audio recording device.
  3334. @return
  3335. - 0: Success.
  3336. - < 0: Failure.
  3337. */
  3338. virtual int getRecordingDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
  3339. /** Retrieves the audio recording device information associated with the device ID and device name.
  3340. @param deviceId Pointer to the device ID of the recording audio device.
  3341. @param deviceName Pointer to the device name of the recording audio device.
  3342. @return
  3343. - 0: Success.
  3344. - < 0: Failure.
  3345. */
  3346. virtual int getRecordingDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], char deviceName[MAX_DEVICE_ID_LENGTH]) = 0;
  3347. /** Starts the audio device loopback test.
  3348. This method tests whether the local audio devices are working properly. After calling this method, the microphone captures the local audio and plays it through the speaker. The \ref IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" callback returns the local audio volume information at the set interval.
  3349. @note This method tests the local audio devices and does not report the network conditions.
  3350. @param indicationInterval The time interval (ms) at which the \ref IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" callback returns.
  3351. @return
  3352. - 0: Success.
  3353. - < 0: Failure.
  3354. */
  3355. virtual int startAudioDeviceLoopbackTest(int indicationInterval) = 0;
  3356. /** Stops the audio device loopback test.
  3357. @note Ensure that you call this method to stop the loopback test after calling the \ref IAudioDeviceManager::startAudioDeviceLoopbackTest "startAudioDeviceLoopbackTest" method.
  3358. @return
  3359. - 0: Success.
  3360. - < 0: Failure.
  3361. */
  3362. virtual int stopAudioDeviceLoopbackTest() = 0;
  3363. /** Releases all IAudioDeviceManager resources.
  3364. */
  3365. virtual void release() = 0;
  3366. };
  3367. /** Definition of RtcEngineContext.
  3368. */
  3369. struct RtcEngineContext
  3370. {
  3371. IRtcEngineEventHandler* eventHandler;
  3372. /** App ID issued to you by Agora. Apply for a new App ID from Agora if
  3373. * it is missing from your kit.
  3374. */
  3375. const char* appId;
  3376. // For android, it the context(Activity or Application
  3377. // for windows,Video hot plug device
  3378. void* context;
  3379. RtcEngineContext()
  3380. /** The IRtcEngineEventHandler object.
  3381. */
  3382. :eventHandler(NULL)
  3383. /** The App ID issued to your project by Agora.
  3384. */
  3385. ,appId(NULL)
  3386. /** The video window handle. Once set, this parameter enables you to plug
  3387. * or unplug the video devices while they are powered.
  3388. */
  3389. ,context(NULL)
  3390. {}
  3391. };
  3392. /** Definition of IMetadataObserver
  3393. */
  3394. class IMetadataObserver
  3395. {
  3396. public:
  3397. /** Metadata type of the observer.
  3398. @note We only support video metadata for now.
  3399. */
  3400. enum METADATA_TYPE
  3401. {
  3402. /** -1: the metadata type is unknown.
  3403. */
  3404. UNKNOWN_METADATA = -1,
  3405. /** 0: the metadata type is video.
  3406. */
  3407. VIDEO_METADATA = 0,
  3408. };
  3409. struct Metadata
  3410. {
  3411. /** The User ID.
  3412. - For the receiver: the ID of the user who sent the metadata.
  3413. - For the sender: ignore it.
  3414. */
  3415. unsigned int uid;
  3416. /** Buffer size of the sent or received Metadata.
  3417. */
  3418. unsigned int size;
  3419. /** Buffer address of the sent or received Metadata.
  3420. */
  3421. unsigned char *buffer;
  3422. /** Time statmp of the frame following the metadata.
  3423. */
  3424. long long timeStampMs;
  3425. };
  3426. virtual ~IMetadataObserver() {};
  3427. /** Occurs when the SDK requests the maximum size of the Metadata.
  3428. The metadata includes the following parameters:
  3429. - `uid`: ID of the user who sends the metadata.
  3430. - `size`: The size of the sent or received metadata.
  3431. - `buffer`: The sent or received metadata.
  3432. - `timeStampMs`: The timestamp of the metadata.
  3433. The SDK triggers this callback after you successfully call the \ref agora::rtc::IRtcEngine::registerMediaMetadataObserver "registerMediaMetadataObserver" method. You need to specify the maximum size of the metadata in the return value of this callback.
  3434. @return The maximum size of the buffer of the metadata that you want to use. The highest value is 1024 bytes. Ensure that you set the return value.
  3435. */
  3436. virtual int getMaxMetadataSize() = 0;
  3437. /** Occurs when the SDK is ready to receive and send metadata.
  3438. @note Ensure that the size of the metadata does not exceed the value set in the \ref agora::rtc::IMetadataObserver::getMaxMetadataSize "getMaxMetadataSize" callback.
  3439. @param metadata The Metadata to be sent.
  3440. @return
  3441. - true: Send.
  3442. - false: Do not send.
  3443. */
  3444. virtual bool onReadyToSendMetadata(Metadata &metadata) = 0;
  3445. /** Occurs when the local user receives the metadata.
  3446. @param metadata The received Metadata.
  3447. */
  3448. virtual void onMetadataReceived(const Metadata &metadata) = 0;
  3449. };
  3450. /** IRtcEngine is the base interface class of the Agora SDK that provides the main Agora SDK methods invoked by your application.
  3451. Enable the Agora SDK's communication functionality through the creation of an IRtcEngine object, then call the methods of this object.
  3452. */
  3453. class IRtcEngine
  3454. {
  3455. protected:
  3456. virtual ~IRtcEngine() {}
  3457. public:
  3458. /** Initializes the Agora SDK service.
  3459. *
  3460. * Ensure that you call the
  3461. * \ref agora::rtc::IRtcEngine::createAgoraRtcEngine
  3462. * "createAgoraRtcEngine" and \ref agora::rtc::IRtcEngine::initialize
  3463. * "initialize" methods before calling any other API.
  3464. *
  3465. * @param context Pointer to the RTC engine context. See RtcEngineContext.
  3466. *
  3467. * @return
  3468. * - 0: Success.
  3469. * - < 0: Failure.
  3470. */
  3471. virtual int initialize(const RtcEngineContext& context) = 0;
  3472. /** Releases all IRtcEngine resources.
  3473. @param sync
  3474. - true: (Synchronous call) The result returns after the IRtcEngine resources are released. The application should not call this method in the SDK generated callbacks. Otherwise, the SDK must wait for the callbacks to return to recover the associated IRtcEngine resources, resulting in a deadlock. The SDK automatically detects the deadlock and converts this method into an asynchronous call, causing the test to take additional time.
  3475. - false: (Asynchronous call) The result returns immediately, even when the IRtcEngine resources have not been released. The SDK releases all resources.
  3476. @note Do not immediately uninstall the SDK's dynamic library after the call, or it may cause a crash due to the SDK clean-up thread not quitting.
  3477. */
  3478. virtual void release(bool sync=false) = 0;
  3479. /** Sets the channel profile.
  3480. The SDK needs to know the application scenario to set the appropriate channel profile to apply different optimization methods.
  3481. @note
  3482. - Users in the same channel must use the same channel profile.
  3483. - Before calling this method to set a new channel profile, \ref IRtcEngine::release "release" the current engine and create a new engine using createAgoraRtcEngine() and \ref IRtcEngine::initialize "initialize".
  3484. - Call this method before a user \ref IRtcEngine::joinChannel "joins a channel" because you cannot configure the channel profile when the channel is in use.
  3485. - In the Communication profile, the Agora SDK supports encoding only in raw data, not in texture.
  3486. @param profile Sets the channel profile. See #CHANNEL_PROFILE_TYPE.
  3487. @return
  3488. - 0: Success.
  3489. - < 0: Failure.
  3490. */
  3491. virtual int setChannelProfile(CHANNEL_PROFILE_TYPE profile) = 0;
  3492. /** Sets the role of the user, such as a host or an audience (default), before joining a channel in a live broadcast.
  3493. This method can be used to switch the user role in a live broadcast after the user joins a channel.
  3494. In the Live Broadcast profile, when a user switches user roles after joining a channel, a successful \ref agora::rtc::IRtcEngine::setClientRole "setClientRole" method call triggers the following callbacks:
  3495. - The local client: \ref agora::rtc::IRtcEngineEventHandler::onClientRoleChanged "onClientRoleChanged"
  3496. - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" or \ref agora::rtc::IRtcEngineEventHandler::onUserOffline "onUserOffline" (BECOME_AUDIENCE)
  3497. @param role Sets the role of the user. See #CLIENT_ROLE_TYPE.
  3498. @return
  3499. - 0: Success.
  3500. - < 0: Failure.
  3501. */
  3502. virtual int setClientRole(CLIENT_ROLE_TYPE role) = 0;
  3503. /** Allows a user to join a channel.
  3504. Users in the same channel can talk to each other, and multiple users in the same channel can start a group chat. Users with different App IDs cannot call each other.
  3505. You must call the \ref IRtcEngine::leaveChannel "leaveChannel" method to exit the current call before entering another channel.
  3506. A successful \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method call triggers the following callbacks:
  3507. - The local client: \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess"
  3508. - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" , if the user joining the channel is in the Communication profile, or is a BROADCASTER in the Live Broadcast profile.
  3509. When the connection between the client and Agora's server is interrupted due to poor network conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins the channel, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onRejoinChannelSuccess "onRejoinChannelSuccess" callback on the local client.
  3510. @note A channel does not accept duplicate uids, such as two users with the same @p uid. If you set @p uid as 0, the system automatically assigns a @p uid. If you want to join a channel from different devices, ensure that each device has a different uid.
  3511. @warning Ensure that the App ID used for creating the token is the same App ID used by the \ref IRtcEngine::initialize "initialize" method for initializing the RTC engine. Otherwise, the CDN live streaming may fail.
  3512. @param token Pointer to the token generated by the application server. In most circumstances, a static App ID suffices. For added security, use a Channel Key.
  3513. - If the user uses a static App ID, *token* is optional and can be set as NULL.
  3514. - If the user uses a Channel Key, Agora issues an additional App Certificate for you to generate a user key based on the algorithm and App Certificate for user authentication on the server.
  3515. @param channelId Pointer to the unique channel name for the Agora RTC session in the string format smaller than 64 bytes. Supported characters:
  3516. - The 26 lowercase English letters: a to z
  3517. - The 26 uppercase English letters: A to Z
  3518. - The 10 numbers: 0 to 9
  3519. - The space
  3520. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ","
  3521. @param info (Optional) Pointer to additional information about the channel. This parameter can be set to NULL or contain channel related information. Other users in the channel will not receive this message.
  3522. @param uid (Optional) User ID. A 32-bit unsigned integer with a value ranging from 1 to 2<sup>32</sup>-1. The @p uid must be unique. If a @p uid is not assigned (or set to 0), the SDK assigns and returns a @p uid in the \ref IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" callback. Your application must record and maintain the returned *uid* since the SDK does not do so.
  3523. @return
  3524. - 0: Success.
  3525. - < 0: Failure.
  3526. - #ERR_INVALID_ARGUMENT (-2)
  3527. - #ERR_NOT_READY (-3)
  3528. - #ERR_REFUSED (-5)
  3529. */
  3530. virtual int joinChannel(const char* token, const char* channelId, const char* info, uid_t uid) = 0;
  3531. /** Switches to a different channel.
  3532. *
  3533. * This method allows the audience of a Live-broadcast channel to switch
  3534. * to a different channel.
  3535. *
  3536. * After the user successfully switches to another channel, the
  3537. * \ref agora::rtc::IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel"
  3538. * and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess
  3539. * "onJoinChannelSuccess" callbacks are triggered to indicate that the
  3540. * user has left the original channel and joined a new one.
  3541. *
  3542. * @note
  3543. * This method applies to the audience role in a Live-broadcast channel
  3544. * only.
  3545. *
  3546. * @param token The token generated at your server:
  3547. * - For low-security requirements: You can use the temporary token
  3548. * generated in Dashboard. For details, see
  3549. * [Get a temporary token](https://docs.agora.io/en/Agora%20Platform/token?platfor%20*%20m=All%20Platforms#get-a-temporary-token).
  3550. * - For high-security requirements: Use the token generated at your
  3551. * server. For details, see
  3552. * [Get a token](https://docs.agora.io/en/Agora%20Platform/token?platfor%20*%20m=All%20Platforms#get-a-token).
  3553. * @param channelId Unique channel name for the AgoraRTC session in the
  3554. * string format. The string length must be less than 64 bytes. Supported
  3555. * character scopes are:
  3556. * - The 26 lowercase English letters: a to z.
  3557. * - The 26 uppercase English letters: A to Z.
  3558. * - The 10 numbers: 0 to 9.
  3559. * - The space.
  3560. * - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".",
  3561. * ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  3562. *
  3563. * @return
  3564. * - 0: Success.
  3565. * - <0: Failure.
  3566. */
  3567. virtual int switchChannel(const char* token, const char* channelId) = 0;
  3568. /** Allows a user to leave a channel, such as hanging up or exiting a call.
  3569. After joining a channel, the user must call the *leaveChannel* method to end the call before joining another channel.
  3570. This method returns 0 if the user leaves the channel and releases all resources related to the call.
  3571. This method call is asynchronous, and the user has not left the channel when the method call returns. Once the user leaves the channel, the SDK triggers the \ref IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel" callback.
  3572. A successful \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method call triggers the following callbacks:
  3573. - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel"
  3574. - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserOffline "onUserOffline" , if the user leaving the channel is in the Communication channel, or is a BROADCASTER in the Live Broadcast profile.
  3575. @note
  3576. - If you call the \ref IRtcEngine::release "release" method immediately after the *leaveChannel* method, the *leaveChannel* process interrupts, and the \ref IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel" callback is not triggered.
  3577. - If you call the *leaveChannel* method during a CDN live streaming, the SDK triggers the \ref IRtcEngine::removePublishStreamUrl "removePublishStreamUrl" method.
  3578. @return
  3579. - 0: Success.
  3580. - < 0: Failure.
  3581. */
  3582. virtual int leaveChannel() = 0;
  3583. /** Gets a new token when the current token expires after a period of time.
  3584. The *token* expires after a period of time once the token schema is enabled when:
  3585. - The SDK triggers the \ref IRtcEngineEventHandler::onTokenPrivilegeWillExpire "onTokenPrivilegeWillExpire" callback, or
  3586. - The \ref IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" reports CONNECTION_CHANGED_TOKEN_EXPIRED(9).
  3587. The application should call this method to get the new *token*. Failure to do so will result in the SDK disconnecting from the server.
  3588. @param token Pointer to the new token.
  3589. @return
  3590. - 0: Success.
  3591. - < 0: Failure.
  3592. */
  3593. virtual int renewToken(const char* token) = 0;
  3594. /** Retrieves the pointer to the device manager object.
  3595. @param iid ID of the interface.
  3596. @param inter Pointer to the *DeviceManager* object.
  3597. @return
  3598. - 0: Success.
  3599. - < 0: Failure.
  3600. */
  3601. virtual int queryInterface(INTERFACE_ID_TYPE iid, void** inter) = 0;
  3602. /** Registers a user account.
  3603. Once registered, the user account can be used to identify the local user when the user joins the channel.
  3604. After the user successfully registers a user account, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" callback on the local client,
  3605. reporting the user ID and user account of the local user.
  3606. To join a channel with a user account, you can choose either of the following:
  3607. - Call the \ref agora::rtc::IRtcEngine::registerLocalUserAccount "registerLocalUserAccount" method to create a user account, and then the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method to join the channel.
  3608. - Call the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method to join the channel.
  3609. The difference between the two is that for the former, the time elapsed between calling the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method
  3610. and joining the channel is shorter than the latter.
  3611. @note
  3612. - Ensure that you set the `userAccount` parameter. Otherwise, this method does not take effect.
  3613. - Ensure that the value of the `userAccount` parameter is unique in the channel.
  3614. - To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type.
  3615. @param appId The App ID of your project.
  3616. @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are:
  3617. - The 26 lowercase English letters: a to z.
  3618. - The 26 uppercase English letters: A to Z.
  3619. - The 10 numbers: 0 to 9.
  3620. - The space.
  3621. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  3622. @return
  3623. - 0: Success.
  3624. - < 0: Failure.
  3625. */
  3626. virtual int registerLocalUserAccount(
  3627. const char* appId, const char* userAccount) = 0;
  3628. /** Joins the channel with a user account.
  3629. After the user successfully joins the channel, the SDK triggers the following callbacks:
  3630. - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" .
  3631. The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the Communication profile, or is a BROADCASTER in the Live Broadcast profile.
  3632. @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account.
  3633. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type.
  3634. @param token The token generated at your server:
  3635. - For low-security requirements: You can use the temporary token generated at Dashboard. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token).
  3636. - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token).
  3637. @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are:
  3638. The 26 lowercase English letters: a to z.
  3639. - The 26 uppercase English letters: A to Z.
  3640. - The 10 numbers: 0 to 9.
  3641. - The space.
  3642. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  3643. @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are:
  3644. - The 26 lowercase English letters: a to z.
  3645. - The 26 uppercase English letters: A to Z.
  3646. - The 10 numbers: 0 to 9.
  3647. - The space.
  3648. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  3649. @return
  3650. - 0: Success.
  3651. - < 0: Failure.
  3652. */
  3653. virtual int joinChannelWithUserAccount(
  3654. const char* token, const char* channelId, const char* userAccount) = 0;
  3655. /** Gets the user information by passing in the user account.
  3656. After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them
  3657. in a mapping table object (`userInfo`), and triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback on the local client.
  3658. After receiving the o\ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback, you can call this method to get the user ID of the
  3659. remote user from the `userInfo` object by passing in the user account.
  3660. @param userAccount The user account of the user. Ensure that you set this parameter.
  3661. @param[in/out] userInfo A userInfo object that identifies the user:
  3662. - Input: A userInfo object.
  3663. - Output: A userInfo object that contains the user account and user ID of the user.
  3664. @return
  3665. - 0: Success.
  3666. - < 0: Failure.
  3667. */
  3668. virtual int getUserInfoByUserAccount(const char* userAccount, UserInfo* userInfo) = 0;
  3669. /** Gets the user information by passing in the user ID.
  3670. After a remote user joins the channel, the SDK gets the user ID and user account of the remote user,
  3671. caches them in a mapping table object (`userInfo`), and triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback on the local client.
  3672. After receiving the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback, you can call this method to get the user account of the remote user
  3673. from the `userInfo` object by passing in the user ID.
  3674. @param uid The user ID of the remote user. Ensure that you set this parameter.
  3675. @param[in/out] userInfo A userInfo object that identifies the user:
  3676. - Input: A userInfo object.
  3677. - Output: A userInfo object that contains the user account and user ID of the user.
  3678. @return
  3679. - 0: Success.
  3680. - < 0: Failure.
  3681. */
  3682. virtual int getUserInfoByUid(uid_t uid, UserInfo* userInfo) = 0;
  3683. /** **DEPRECATED** Starts an audio call test.
  3684. This method is deprecated as of v2.4.0.
  3685. This method starts an audio call test to check whether the audio devices (for example, headset and speaker) and the network connection are working properly.
  3686. To conduct the test:
  3687. - The user speaks and the recording is played back within 10 seconds.
  3688. - If the user can hear the recording within 10 seconds, the audio devices and network connection are working properly.
  3689. @note
  3690. - After calling this method, always call the \ref IRtcEngine::stopEchoTest "stopEchoTest" method to end the test. Otherwise, the application cannot run the next echo test.
  3691. - In the Live-broadcast profile, only the hosts can call this method. If the user switches from the Communication to Live-broadcast profile, the user must call the \ref IRtcEngine::setClientRole "setClientRole" method to change the user role from the audience (default) to the host before calling this method.
  3692. @return
  3693. - 0: Success.
  3694. - < 0: Failure.
  3695. */
  3696. virtual int startEchoTest() = 0;
  3697. /** Starts an audio call test.
  3698. This method starts an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
  3699. In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly.
  3700. @note
  3701. - Call this method before joining a channel.
  3702. - After calling this method, call the \ref IRtcEngine::stopEchoTest "stopEchoTest" method to end the test. Otherwise, the app cannot run the next echo test, or call the \ref IRtcEngine::joinChannel "joinChannel" method.
  3703. - In the Live-broadcast profile, only a host can call this method.
  3704. @param intervalInSeconds The time interval (s) between when you speak and when the recording plays back.
  3705. @return
  3706. - 0: Success.
  3707. - < 0: Failure.
  3708. */
  3709. virtual int startEchoTest(int intervalInSeconds) = 0;
  3710. /** Stops the audio call test.
  3711. @return
  3712. - 0: Success.
  3713. - < 0: Failure.
  3714. */
  3715. virtual int stopEchoTest() = 0;
  3716. /** Enables the video module.
  3717. Call this method either before joining a channel or during a call. If this method is called before joining a channel, the call starts in the video mode. If this method is called during an audio call, the audio mode switches to the video mode. To disable the video module, call the \ref IRtcEngine::disableVideo "disableVideo" method.
  3718. A successful \ref agora::rtc::IRtcEngine::enableVideo "enableVideo" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserEnableVideo "onUserEnableVideo" (true) callback on the remote client.
  3719. @note
  3720. - This method affects the internal engine and can be called after the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method.
  3721. - This method resets the internal engine and takes some time to take effect. We recommend using the following API methods to control the video engine modules separately:
  3722. - \ref IRtcEngine::enableLocalVideo "enableLocalVideo": Whether to enable the camera to create the local video stream.
  3723. - \ref IRtcEngine::muteLocalVideoStream "muteLocalVideoStream": Whether to publish the local video stream.
  3724. - \ref IRtcEngine::muteRemoteVideoStream "muteRemoteVideoStream": Whether to subscribe to and play the remote video stream.
  3725. - \ref IRtcEngine::muteAllRemoteVideoStreams "muteAllRemoteVideoStreams": Whether to subscribe to and play all remote video streams.
  3726. @return
  3727. - 0: Success.
  3728. - < 0: Failure.
  3729. */
  3730. virtual int enableVideo() = 0;
  3731. /** Disables the video module.
  3732. This method can be called before joining a channel or during a call. If this method is called before joining a channel, the call starts in audio mode. If this method is called during a video call, the video mode switches to the audio mode. To enable the video module, call the \ref IRtcEngine::enableVideo "enableVideo" method.
  3733. A successful \ref agora::rtc::IRtcEngine::disableVideo "disableVideo" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserEnableVideo "onUserEnableVideo" (false) callback on the remote client.
  3734. @note
  3735. - This method affects the internal engine and can be called after the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method.
  3736. - This method resets the internal engine and takes some time to take effect. We recommend using the following API methods to control the video engine modules separately:
  3737. - \ref IRtcEngine::enableLocalVideo "enableLocalVideo": Whether to enable the camera to create the local video stream.
  3738. - \ref IRtcEngine::muteLocalVideoStream "muteLocalVideoStream": Whether to publish the local video stream.
  3739. - \ref IRtcEngine::muteRemoteVideoStream "muteRemoteVideoStream": Whether to subscribe to and play the remote video stream.
  3740. - \ref IRtcEngine::muteAllRemoteVideoStreams "muteAllRemoteVideoStreams": Whether to subscribe to and play all remote video streams.
  3741. @return
  3742. - 0: Success.
  3743. - < 0: Failure.
  3744. */
  3745. virtual int disableVideo() = 0;
  3746. /** **DEPRECATED** Sets the video profile.
  3747. This method is deprecated as of v2.3. Use the \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration" method instead.
  3748. Each video profile includes a set of parameters, such as the resolution, frame rate, and bitrate. If the camera device does not support the specified resolution, the SDK automatically chooses a suitable camera resolution, keeping the encoder resolution specified by the *setVideoProfile* method.
  3749. @note
  3750. - If you do not need to set the video profile after joining the channel, call this method before the \ref IRtcEngine::enableVideo "enableVideo" method to reduce the render time of the first video frame.
  3751. - Always set the video profile before calling the \ref IRtcEngine::joinChannel "joinChannel" or \ref IRtcEngine::startPreview "startPreview" method.
  3752. @param profile Sets the video profile. See #VIDEO_PROFILE_TYPE.
  3753. @param swapWidthAndHeight Sets whether to swap the width and height of the video stream:
  3754. - true: Swap the width and height.
  3755. - false: (Default) Do not swap the width and height.
  3756. The width and height of the output video are consistent with the set video profile.
  3757. @note Since the landscape or portrait mode of the output video can be decided directly by the video profile, We recommend setting *swapWidthAndHeight* to *false* (default).
  3758. @return
  3759. - 0: Success.
  3760. - < 0: Failure.
  3761. */
  3762. virtual int setVideoProfile(VIDEO_PROFILE_TYPE profile, bool swapWidthAndHeight) = 0;
  3763. /** Sets the video encoder configuration.
  3764. Each video encoder configuration corresponds to a set of video parameters, including the resolution, frame rate, bitrate, and video orientation.
  3765. The parameters specified in this method are the maximum values under ideal network conditions. If the video engine cannot render the video using the specified parameters due to poor network conditions, the parameters further down the list are considered until a successful configuration is found.
  3766. @note If you do not need to set the video encoder configuration after joining the channel, you can call this method before the \ref IRtcEngine::enableVideo "enableVideo" method to reduce the render time of the first video frame.
  3767. @param config Sets the local video encoder configuration. See VideoEncoderConfiguration.
  3768. @return
  3769. - 0: Success.
  3770. - < 0: Failure.
  3771. */
  3772. virtual int setVideoEncoderConfiguration(const VideoEncoderConfiguration& config) = 0;
  3773. /** Sets the camera capture configuration.
  3774. For a video call or live broadcast, generally the SDK controls the camera output parameters. When the default camera capturer settings do not meet special requirements or cause performance problems, we recommend using this method to set the camera capturer configuration:
  3775. - If the resolution or frame rate of the captured raw video data are higher than those set by \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration", processing video frames requires extra CPU and RAM usage and degrades performance. We recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE = 1 to avoid such problems.
  3776. - If you do not need local video preview or are willing to sacrifice preview quality, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE = 1 to optimize CPU and RAM usage.
  3777. - If you want better quality for the local video preview, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PREVIEW = 2.
  3778. @note Call this method before enabling the local camera. That said, you can call this method before calling \ref agora::rtc::IRtcEngine::joinChannel "joinChannel", \ref agora::rtc::IRtcEngine::enableVideo "enableVideo", or \ref IRtcEngine::enableLocalVideo "enableLocalVideo", depending on which method you use to turn on your local camera.
  3779. @param config Sets the camera capturer configuration. See CameraCapturerConfiguration.
  3780. @return
  3781. - 0: Success.
  3782. - < 0: Failure.
  3783. */
  3784. virtual int setCameraCapturerConfiguration(const CameraCapturerConfiguration& config) = 0;
  3785. /** Sets the local video view and configures the video display settings on the local machine.
  3786. The application calls this method to bind each video window (view) of the local video streams and configures the video display settings. Call this method after initialization to configure the local video display settings before joining a channel. The binding is still valid after the user leaves the channel, which means that the window still displays. To unbind the view, set the *view* in VideoCanvas to NULL.
  3787. @param canvas Pointer to the local video view and settings. See VideoCanvas.
  3788. @return
  3789. - 0: Success.
  3790. - < 0: Failure.
  3791. */
  3792. virtual int setupLocalVideo(const VideoCanvas& canvas) = 0;
  3793. /** Sets the remote video view.
  3794. This method binds the remote user to the video display window (sets the view for the remote user by the specified uid in VideoCanvas).
  3795. The application specifies the uid of the remote video in this method before the remote user joins the channel.
  3796. If the remote uid is unknown to the application, set it after the application receives the \ref IRtcEngineEventHandler::onUserJoined "onUserJoined" callback.
  3797. If the Video Recording function is enabled, the Video Recording Service joins the channel as a dummy client, causing other clients to also receive the \ref IRtcEngineEventHandler::onUserJoined "onUserJoined" callback. Do not bind the dummy client to the application view because the dummy client does not send any video streams. If your application does not recognize the dummy client, bind the remote user to the view when the SDK triggers the \ref IRtcEngineEventHandler::onFirstRemoteVideoDecoded "onFirstRemoteVideoDecoded" callback.
  3798. To unbind the remote user from the view, set the view in VideoCanvas to NULL. Once the remote user leaves the channel, the SDK unbinds the remote user.
  3799. @param canvas Pointer to the remote video view and settings. See VideoCanvas.
  3800. @return
  3801. - 0: Success.
  3802. - < 0: Failure.
  3803. */
  3804. virtual int setupRemoteVideo(const VideoCanvas& canvas) = 0;
  3805. /** Starts the local video preview before joining the channel.
  3806. Before calling this method, you must:
  3807. - Call the \ref IRtcEngine::setupLocalVideo "setupLocalVideo" method to set up the local preview window and configure the attributes.
  3808. - Call the \ref IRtcEngine::enableVideo "enableVideo" method to enable video.
  3809. @note Once the startPreview method is called to start the local video preview, if you leave the channel by calling the \ref IRtcEngine::leaveChannel "leaveChannel" method, the local video preview remains until you call the \ref IRtcEngine::stopPreview "stopPreview" method to disable it.
  3810. @return
  3811. - 0: Success.
  3812. - < 0: Failure.
  3813. */
  3814. virtual int startPreview() = 0;
  3815. /** Prioritizes a remote user's stream.
  3816. Use this method with the \ref IRtcEngine::setRemoteSubscribeFallbackOption "setRemoteSubscribeFallbackOption" method. If the fallback function is enabled for a subscribed stream, the SDK ensures the high-priority user gets the best possible stream quality.
  3817. @note The Agora SDK supports setting @p userPriority as high for one user only.
  3818. @param uid The ID of the remote user.
  3819. @param userPriority Sets the priority of the remote user. See #PRIORITY_TYPE.
  3820. @return
  3821. - 0: Success.
  3822. - < 0: Failure.
  3823. */
  3824. virtual int setRemoteUserPriority(uid_t uid, PRIORITY_TYPE userPriority) = 0;
  3825. /** Stops the local video preview and disables video.
  3826. @return
  3827. - 0: Success.
  3828. - < 0: Failure.
  3829. */
  3830. virtual int stopPreview() = 0;
  3831. /** Enables the audio module.
  3832. The audio mode is enabled by default.
  3833. @note
  3834. - This method affects the internal engine and can be called after the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method. You can call this method either before or after joining a channel.
  3835. - This method resets the internal engine and takes some time to take effect. We recommend using the following API methods to control the audio engine modules separately:
  3836. - \ref IRtcEngine::enableLocalAudio "enableLocalAudio": Whether to enable the microphone to create the local audio stream.
  3837. - \ref IRtcEngine::muteLocalAudioStream "muteLocalAudioStream": Whether to publish the local audio stream.
  3838. - \ref IRtcEngine::muteRemoteAudioStream "muteRemoteAudioStream": Whether to subscribe to and play the remote audio stream.
  3839. - \ref IRtcEngine::muteAllRemoteAudioStreams "muteAllRemoteAudioStreams": Whether to subscribe to and play all remote audio streams.
  3840. @return
  3841. - 0: Success.
  3842. - < 0: Failure.
  3843. */
  3844. virtual int enableAudio() = 0;
  3845. /** Disables/Re-enables the local audio function.
  3846. The audio function is enabled by default. This method disables or re-enables the local audio function, that is, to stop or restart local audio capturing.
  3847. This method does not affect receiving or playing the remote audio streams,and enableLocalAudio(false) is applicable to scenarios where the user wants to receive remote audio streams without sending any audio stream to other users in the channel.
  3848. The SDK triggers the \ref IRtcEngineEventHandler::onMicrophoneEnabled "onMicrophoneEnabled" callback once the local audio function is disabled or enabled.
  3849. @note
  3850. - Call this method after the \ref IRtcEngine::joinChannel "joinChannel" method.
  3851. - This method is different from the \ref agora::rtc::IRtcEngine::muteLocalAudioStream "muteLocalAudioStream" method:
  3852. - \ref agora::rtc::IRtcEngine::enableLocalAudio "enableLocalAudio": Disables/Re-enables the local audio capturing and processing.
  3853. - \ref agora::rtc::IRtcEngine::muteLocalAudioStream "muteLocalAudioStream": Sends/Stops sending the local audio streams.
  3854. @param enabled Sets whether to disable/re-enable the local audio function:
  3855. - true: (Default) Re-enable the local audio function, that is, to start the local audio capturing device (for example, the microphone).
  3856. - false: Disable the local audio function, that is, to stop local audio capturing.
  3857. @return
  3858. - 0: Success.
  3859. - < 0: Failure.
  3860. */
  3861. virtual int enableLocalAudio(bool enabled) = 0;
  3862. /** Disables the audio module.
  3863. @note
  3864. - This method affects the internal engine and can be called after the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method. You can call this method either before or after joining a channel.
  3865. - This method resets the internal engine and takes some time to take effect. We recommend using the \ref agora::rtc::IRtcEngine::enableLocalAudio "enableLocalAudio" and \ref agora::rtc::IRtcEngine::muteLocalAudioStream "muteLocalAudioStream" methods to capture, process, and send the local audio streams.
  3866. @return
  3867. - 0: Success.
  3868. - < 0: Failure.
  3869. */
  3870. virtual int disableAudio() = 0;
  3871. /** Sets the audio parameters and application scenarios.
  3872. @note
  3873. - The *setAudioProfile* method must be called before the \ref IRtcEngine::joinChannel "joinChannel" method.
  3874. - In the Communication and Live-broadcast profiles, the bitrate may be different from your settings due to network self-adaptation.
  3875. - In scenarios involving music education, we recommend setting profile as #AUDIO_PROFILE_MUSIC_HIGH_QUALITY (4) and scenario as #AUDIO_SCENARIO_GAME_STREAMING (3).
  3876. @param profile Sets the sample rate, bitrate, encoding mode, and the number of channels. See #AUDIO_PROFILE_TYPE.
  3877. @param scenario Sets the audio application scenario. See #AUDIO_SCENARIO_TYPE. Under different audio scenarios, the device uses different volume tracks, i.e. either the in-call volume or the media volume. For details, see [What is the difference between the in-call volume and the media volume?](https://docs.agora.io/en/faq/system_volume).
  3878. @return
  3879. - 0: Success.
  3880. - < 0: Failure.
  3881. */
  3882. virtual int setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) = 0;
  3883. /** Stops/Resumes sending the local audio stream.
  3884. A successful \ref agora::rtc::IRtcEngine::muteLocalAudioStream "muteLocalAudioStream" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserMuteAudio "onUserMuteAudio" callback on the remote client.
  3885. @note When @p mute is set as @p true, this method does not disable the microphone, which does not affect any ongoing recording.
  3886. @param mute Sets whether to send/stop sending the local audio stream:
  3887. - true: Stops sending the local audio stream.
  3888. - false: (Default) Sends the local audio stream.
  3889. @return
  3890. - 0: Success.
  3891. - < 0: Failure.
  3892. */
  3893. virtual int muteLocalAudioStream(bool mute) = 0;
  3894. /** Stops/Resumes receiving all remote users' audio streams.
  3895. @param mute Sets whether to receive/stop receiving all remote users' audio streams.
  3896. - true: Stops receiving all remote users' audio streams.
  3897. - false: (Default) Receives all remote users' audio streams.
  3898. @return
  3899. - 0: Success.
  3900. - < 0: Failure.
  3901. */
  3902. virtual int muteAllRemoteAudioStreams(bool mute) = 0;
  3903. /** Stops/Resumes receiving all remote users' audio streams by default.
  3904. @param mute Sets whether to receive/stop receiving all remote users' audio streams by default:
  3905. - true: Stops receiving all remote users' audio streams by default.
  3906. - false: (Default) Receives all remote users' audio streams by default.
  3907. @return
  3908. - 0: Success.
  3909. - < 0: Failure.
  3910. */
  3911. virtual int setDefaultMuteAllRemoteAudioStreams(bool mute) = 0;
  3912. /** Stops/Resumes receiving a specified remote user's audio stream.
  3913. @note If you called the \ref agora::rtc::IRtcEngine::muteAllRemoteAudioStreams "muteAllRemoteAudioStreams" method and set @p mute as @p true to stop receiving all remote users' audio streams, call the *muteAllRemoteAudioStreams* method and set @p mute as @p false before calling this method. The *muteAllRemoteAudioStreams* method sets all remote audio streams, while the *muteRemoteAudioStream* method sets a specified remote audio stream.
  3914. @param userId User ID of the specified remote user sending the audio.
  3915. @param mute Sets whether to receive/stop receiving a specified remote user's audio stream:
  3916. - true: Stops receiving the specified remote user's audio stream.
  3917. - false: (Default) Receives the specified remote user's audio stream.
  3918. @return
  3919. - 0: Success.
  3920. - < 0: Failure.
  3921. */
  3922. virtual int muteRemoteAudioStream(uid_t userId, bool mute) = 0;
  3923. /** Stops/Resumes sending the local video stream.
  3924. A successful \ref agora::rtc::IRtcEngine::muteLocalVideoStream "muteLocalVideoStream" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserMuteVideo "onUserMuteVideo" callback on the remote client.
  3925. @note When set to *true*, this method does not disable the camera which does not affect the retrieval of the local video streams. This method executes faster than the \ref agora::rtc::IRtcEngine::enableLocalVideo "enableLocalVideo" method which controls the sending of the local video stream.
  3926. @param mute Sets whether to send/stop sending the local video stream:
  3927. - true: Stop sending the local video stream.
  3928. - false: (Default) Send the local video stream.
  3929. @return
  3930. - 0: Success.
  3931. - < 0: Failure.
  3932. */
  3933. virtual int muteLocalVideoStream(bool mute) = 0;
  3934. /** Disables/Re-enables the local video.
  3935. This method disables/re-enables the local video and enableLocalVideo(false) is only applicable when the user wants to watch the remote video without sending any video stream to the other user.
  3936. Call this method after calling the \ref agora::rtc::IRtcEngine::enableVideo "enableVideo" method. Otherwise, this method may not work properly.
  3937. After the *enableVideo* method is called, the local video is enabled by default. This method is used to disable/re-enable the local video while the remote video remains unaffected.
  3938. A successful \ref agora::rtc::IRtcEngine::enableLocalVideo "enableLocalVideo" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserEnableLocalVideo "onUserEnableLocalVideo" callback on the remote client.
  3939. @note This method affects the internal engine and can be called after the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method.
  3940. @param enabled Sets whether to disable/re-enable the local video, including the capturer, renderer, and sender:
  3941. - true: (Default) Re-enable the local video.
  3942. - false: Disable the local video. Once the local video is disabled, the remote users can no longer receive the video stream of this user, while this user can still receive the video streams of the other remote users.
  3943. @return
  3944. - 0: Success.
  3945. - < 0: Failure.
  3946. */
  3947. virtual int enableLocalVideo(bool enabled) = 0;
  3948. /** Stops/Resumes receiving all remote users' video streams.
  3949. @param mute Sets whether to receive/stop receiving all remote users' video streams:
  3950. - true: Stop receiving all remote users' video streams.
  3951. - false: (Default) Receive all remote users' video streams.
  3952. @return
  3953. - 0: Success.
  3954. - < 0: Failure.
  3955. */
  3956. virtual int muteAllRemoteVideoStreams(bool mute) = 0;
  3957. /** Stops/Resumes receiving all remote users' video streams by default.
  3958. @param mute Sets whether to receive/stop receiving all remote users' video streams by default:
  3959. - true: Stop receiving all remote users' video streams by default.
  3960. - false: (Default) Receive all remote users' video streams by default.
  3961. @return
  3962. - 0: Success.
  3963. - < 0: Failure.
  3964. */
  3965. virtual int setDefaultMuteAllRemoteVideoStreams(bool mute) = 0;
  3966. /** Stops/Resumes receiving a specified remote user's video stream.
  3967. @note If you called the \ref agora::rtc::IRtcEngine::muteAllRemoteVideoStreams "muteAllRemoteVideoStreams" method and set @p mute as @p true to stop receiving all remote video streams, call the *muteAllRemoteVideoStreams* method and set @p mute as @p false before calling this method.
  3968. @param userId User ID of the specified remote user.
  3969. @param mute Sets whether to receive/stop receiving the specified remote user's video stream:
  3970. - true: Stop receiving the specified remote user's video stream.
  3971. - false: (Default) Receive the specified remote user's video stream.
  3972. @return
  3973. - 0: Success.
  3974. - < 0: Failure.
  3975. */
  3976. virtual int muteRemoteVideoStream(uid_t userId, bool mute) = 0;
  3977. /** Sets the remote user's video stream type received by the local user when the remote user sends dual streams.
  3978. This method allows the application to adjust the corresponding video-stream type based on the size of the video window to reduce the bandwidth and resources.
  3979. - If the remote user enables the dual-stream mode by calling the \ref agora::rtc::IRtcEngine::enableDualStreamMode "enableDualStreamMode" method, the SDK receives the high-stream video by default.
  3980. - If the dual-stream mode is not enabled, the SDK receives the high-stream video by default.
  3981. The method result returns in the \ref agora::rtc::IRtcEngineEventHandler::onApiCallExecuted "onApiCallExecuted" callback. The SDK receives the high-stream video by default to reduce the bandwidth. If needed, users may use this method to switch to the low-stream video.
  3982. By default, the aspect ratio of the low-stream video is the same as the high-stream video. Once the resolution of the high-stream video is set, the system automatically sets the resolution, frame rate, and bitrate of the low-stream video.
  3983. @param userId ID of the remote user sending the video stream.
  3984. @param streamType Sets the video-stream type. See #REMOTE_VIDEO_STREAM_TYPE.
  3985. @return
  3986. - 0: Success.
  3987. - < 0: Failure.
  3988. */
  3989. virtual int setRemoteVideoStreamType(uid_t userId, REMOTE_VIDEO_STREAM_TYPE streamType) = 0;
  3990. /** Sets the default video-stream type for the video received by the local user when the remote user sends dual streams.
  3991. - If the dual-stream mode is enabled by calling the \ref agora::rtc::IRtcEngine::enableDualStreamMode "enableDualStreamMode" method, the user receives the high-stream video by default. The @p setRemoteDefaultVideoStreamType method allows the application to adjust the corresponding video-stream type according to the size of the video window, reducing the bandwidth and resources.
  3992. - If the dual-stream mode is not enabled, the user receives the high-stream video by default.
  3993. The result after calling this method is returned in the \ref agora::rtc::IRtcEngineEventHandler::onApiCallExecuted "onApiCallExecuted" callback. The Agora SDK receives the high-stream video by default to reduce the bandwidth. If needed, users can switch to the low-stream video through this method.
  3994. @param streamType Sets the default video-stream type. See #REMOTE_VIDEO_STREAM_TYPE.
  3995. @return
  3996. - 0: Success.
  3997. - < 0: Failure.
  3998. */
  3999. virtual int setRemoteDefaultVideoStreamType(REMOTE_VIDEO_STREAM_TYPE streamType) = 0;
  4000. /** Enables the \ref agora::rtc::IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" callback at a set time interval to report on which users are speaking and the speakers' volume.
  4001. Once this method is enabled, the SDK returns the volume indication in the \ref agora::rtc::IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" callback at the set time interval, whether or not any user is speaking in the channel.
  4002. @param interval Sets the time interval between two consecutive volume indications:
  4003. - &le; 0: Disables the volume indication.
  4004. - > 0: Time interval (ms) between two consecutive volume indications. We recommend setting @p interval &gt; 200 ms. Do not set @p interval &lt; 10 ms, or the *onAudioVolumeIndication* callback will not be triggered.
  4005. @param smooth Smoothing factor sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The greater the value, the more sensitive the indicator. The recommended value is 3.
  4006. @return
  4007. - 0: Success.
  4008. - < 0: Failure.
  4009. */
  4010. virtual int enableAudioVolumeIndication(int interval, int smooth) = 0;
  4011. /** Starts an audio recording.
  4012. The SDK allows recording during a call. Supported formats:
  4013. - .wav: Large file size with high fidelity.
  4014. - .aac: Small file size with low fidelity.
  4015. Ensure that the directory to save the recording file exists and is writable.
  4016. This method is usually called after the \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method.
  4017. The recording automatically stops when the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method is called.
  4018. @param filePath Pointer to the absolute file path of the recording file. The string of the file name is in UTF-8.
  4019. @param quality Sets the audio recording quality. See #AUDIO_RECORDING_QUALITY_TYPE.
  4020. @return
  4021. - 0: Success.
  4022. - < 0: Failure.
  4023. */
  4024. virtual int startAudioRecording(const char* filePath, AUDIO_RECORDING_QUALITY_TYPE quality) = 0;
  4025. /** Stops an audio recording on the client.
  4026. You can call this method before calling the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method else, the recording automatically stops when the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method is called.
  4027. @return
  4028. - 0: Success
  4029. - < 0: Failure.
  4030. */
  4031. virtual int stopAudioRecording() = 0;
  4032. /** Starts playing and mixing the music file.
  4033. This method mixes the specified local audio file with the audio stream from the microphone, or replaces the microphone's audio stream with the specified local audio file. You can choose whether the other user can hear the local audio playback and specify the number of playback loops. This method also supports online music playback.
  4034. When the audio mixing file playback finishes after calling this method, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onAudioMixingFinished "onAudioMixingFinished" callback.
  4035. A successful \ref agora::rtc::IRtcEngine::startAudioMixing "startAudioMixing" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (PLAY) callback on the local client.
  4036. When the audio mixing file playback finishes, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (STOPPED) callback on the local client.
  4037. @note
  4038. - Call this method when you are in a channel.
  4039. - If the local audio mixing file does not exist, or if the SDK does not support the file format or cannot access the music file URL, the SDK returns WARN_AUDIO_MIXING_OPEN_ERROR = 701.
  4040. @param filePath Pointer to the absolute path of the local or online audio file to mix. Supported audio formats: 3GP, ASF, ADTS, AVI, MP3, MPEG-4, SAMI, and WAVE. For more information, see [Supported Media Formats in Media Foundation](https://docs.microsoft.com/en-us/windows/desktop/medfound/supported-media-formats-in-media-foundation).
  4041. @param loopback Sets which user can hear the audio mixing:
  4042. - true: Only the local user can hear the audio mixing.
  4043. - false: Both users can hear the audio mixing.
  4044. @param replace Sets the audio mixing content:
  4045. - true: Only the specified audio file is published; the audio stream received by the microphone is not published.
  4046. - false: The local audio file is mixed with the audio stream from the microphone.
  4047. @param cycle Sets the number of playback loops:
  4048. - Positive integer: Number of playback loops.
  4049. - -1: Infinite playback loops.
  4050. @return
  4051. - 0: Success.
  4052. - < 0: Failure.
  4053. */
  4054. virtual int startAudioMixing(const char* filePath, bool loopback, bool replace, int cycle) = 0;
  4055. /** Stops playing and mixing the music file.
  4056. Call this method when you are in a channel.
  4057. @return
  4058. - 0: Success.
  4059. - < 0: Failure.
  4060. */
  4061. virtual int stopAudioMixing() = 0;
  4062. /** Pauses playing and mixing the music file.
  4063. Call this method when you are in a channel.
  4064. @return
  4065. - 0: Success.
  4066. - < 0: Failure.
  4067. */
  4068. virtual int pauseAudioMixing() = 0;
  4069. /** Resumes playing and mixing the music file.
  4070. Call this method when you are in a channel.
  4071. @return
  4072. - 0: Success.
  4073. - < 0: Failure.
  4074. */
  4075. virtual int resumeAudioMixing() = 0;
  4076. /** Adjusts the volume during audio mixing.
  4077. Call this method when you are in a channel.
  4078. @param volume Audio mixing volume. The value ranges between 0 and 100 (default).
  4079. @return
  4080. - 0: Success.
  4081. - < 0: Failure.
  4082. */
  4083. virtual int adjustAudioMixingVolume(int volume) = 0;
  4084. /** Adjusts the audio mixing volume for local playback.
  4085. @note Call this method when you are in a channel.
  4086. @param volume Audio mixing volume for local playback. The value ranges between 0 and 100 (default).
  4087. @return
  4088. - 0: Success.
  4089. - < 0: Failure.
  4090. */
  4091. virtual int adjustAudioMixingPlayoutVolume(int volume) = 0;
  4092. /** Retrieves the audio mixing volume for local playback.
  4093. This method helps troubleshoot audio volume related issues.
  4094. @note Call this method when you are in a channel.
  4095. @return
  4096. - &ge; 0: The audio mixing volume, if this method call succeeds. The value range is [0,100].
  4097. - < 0: Failure.
  4098. */
  4099. virtual int getAudioMixingPlayoutVolume() = 0;
  4100. /** Adjusts the audio mixing volume for publishing (for remote users).
  4101. @note Call this method when you are in a channel.
  4102. @param volume Audio mixing volume for publishing. The value ranges between 0 and 100 (default).
  4103. @return
  4104. - 0: Success.
  4105. - < 0: Failure.
  4106. */
  4107. virtual int adjustAudioMixingPublishVolume(int volume) = 0;
  4108. /** Retrieves the audio mixing volume for publishing.
  4109. This method helps troubleshoot audio volume related issues.
  4110. @note Call this method when you are in a channel.
  4111. @return
  4112. - &ge; 0: The audio mixing volume for publishing, if this method call succeeds. The value range is [0,100].
  4113. - < 0: Failure.
  4114. */
  4115. virtual int getAudioMixingPublishVolume() = 0;
  4116. /** Retrieves the duration (ms) of the music file.
  4117. Call this method when you are in a channel.
  4118. @return
  4119. - &ge; 0: The audio mixing duration, if this method call succeeds.
  4120. - < 0: Failure.
  4121. */
  4122. virtual int getAudioMixingDuration() = 0;
  4123. /** Retrieves the playback position (ms) of the music file.
  4124. Call this method when you are in a channel.
  4125. @return
  4126. - &ge; 0: The current playback position of the audio mixing, if this method call succeeds.
  4127. - < 0: Failure.
  4128. */
  4129. virtual int getAudioMixingCurrentPosition() = 0;
  4130. /** Sets the playback position of the music file to a different starting position (the default plays from the beginning).
  4131. @param pos The playback starting position (ms) of the music file.
  4132. @return
  4133. - 0: Success.
  4134. - < 0: Failure.
  4135. */
  4136. virtual int setAudioMixingPosition(int pos /*in ms*/) = 0;
  4137. /** Retrieves the volume of the audio effects.
  4138. The value ranges between 0.0 and 100.0.
  4139. @return
  4140. - &ge; 0: Volume of the audio effects, if this method call succeeds.
  4141. - < 0: Failure.
  4142. */
  4143. virtual int getEffectsVolume() = 0;
  4144. /** Sets the volume of the audio effects.
  4145. @param volume Sets the volume of the audio effects. The value ranges between 0 and 100 (default).
  4146. @return
  4147. - 0: Success.
  4148. - < 0: Failure.
  4149. */
  4150. virtual int setEffectsVolume(int volume) = 0;
  4151. /** Sets the volume of a specified audio effect.
  4152. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  4153. @param volume Sets the volume of the specified audio effect. The value ranges between 0 and 100 (default).
  4154. @return
  4155. - 0: Success.
  4156. - < 0: Failure.
  4157. */
  4158. virtual int setVolumeOfEffect(int soundId, int volume) = 0;
  4159. /** Plays a specified local or online audio effect file.
  4160. This method allows you to set the loop count, pitch, pan, and gain of the audio effect file, as well as whether the remote user can hear the audio effect.
  4161. To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time.
  4162. @param soundId ID of the specified audio effect. Each audio effect has a unique ID.
  4163. @note
  4164. - If the audio effect is preloaded into the memory through the \ref IRtcEngine::preloadEffect "preloadEffect" method, the value of @p soundID must be the same as that in the *preloadEffect* method.
  4165. - Playing multiple online audio effect files simultaneously is not supported on macOS and Windows.
  4166. @param filePath The absolute path to the local audio effect file or the URL of the online audio effect file.
  4167. @param loopCount Sets the number of times the audio effect loops:
  4168. - 0: Play the audio effect once.
  4169. - 1: Play the audio effect twice.
  4170. - -1: Play the audio effect in an indefinite loop until the \ref IRtcEngine::stopEffect "stopEffect" or \ref IRtcEngine::stopAllEffects "stopAllEffects" method is called.
  4171. @param pitch Sets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch.
  4172. @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0:
  4173. - 0.0: The audio effect displays ahead.
  4174. - 1.0: The audio effect displays to the right.
  4175. - -1.0: The audio effect displays to the left.
  4176. @param gain Sets the volume of the audio effect. The value ranges between 0 and 100 (default). The lower the value, the lower the volume of the audio effect.
  4177. @param publish Sets whether or not to publish the specified audio effect to the remote stream:
  4178. - true: The locally played audio effect is published to the Agora Cloud and the remote users can hear it.
  4179. - false: The locally played audio effect is not published to the Agora Cloud and the remote users cannot hear it.
  4180. @return
  4181. - 0: Success.
  4182. - < 0: Failure.
  4183. */
  4184. virtual int playEffect(int soundId, const char* filePath, int loopCount, double pitch, double pan, int gain, bool publish = false) = 0;
  4185. /** Stops playing a specified audio effect.
  4186. @param soundId ID of the audio effect to stop playing. Each audio effect has a unique ID.
  4187. @return
  4188. - 0: Success.
  4189. - < 0: Failure.
  4190. */
  4191. virtual int stopEffect(int soundId) = 0;
  4192. /** Stops playing all audio effects.
  4193. @return
  4194. - 0: Success.
  4195. - < 0: Failure.
  4196. */
  4197. virtual int stopAllEffects() = 0;
  4198. /** Preloads a specified audio effect file into the memory.
  4199. @note This method does not support online audio effect files.
  4200. To ensure smooth communication, limit the size of the audio effect file. We recommend using this method to preload the audio effect before calling the \ref IRtcEngine::joinChannel "joinChannel" method.
  4201. Supported audio formats: mp3, aac, m4a, 3gp, and wav.
  4202. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  4203. @param filePath Pointer to the absolute path of the audio effect file.
  4204. @return
  4205. - 0: Success.
  4206. - < 0: Failure.
  4207. */
  4208. virtual int preloadEffect(int soundId, const char* filePath) = 0;
  4209. /** Releases a specified preloaded audio effect from the memory.
  4210. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  4211. @return
  4212. - 0: Success.
  4213. - < 0: Failure.
  4214. */
  4215. virtual int unloadEffect(int soundId) = 0;
  4216. /** Pauses a specified audio effect.
  4217. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  4218. @return
  4219. - 0: Success.
  4220. - < 0: Failure.
  4221. */
  4222. virtual int pauseEffect(int soundId) = 0;
  4223. /** Pauses all audio effects.
  4224. @return
  4225. - 0: Success.
  4226. - < 0: Failure.
  4227. */
  4228. virtual int pauseAllEffects() = 0;
  4229. /** Resumes playing a specified audio effect.
  4230. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  4231. @return
  4232. - 0: Success.
  4233. - < 0: Failure.
  4234. */
  4235. virtual int resumeEffect(int soundId) = 0;
  4236. /** Resumes playing all audio effects.
  4237. @return
  4238. - 0: Success.
  4239. - < 0: Failure.
  4240. */
  4241. virtual int resumeAllEffects() = 0;
  4242. /** Enables/Disables stereo panning for remote users.
  4243. Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling \ref agora::rtc::IRtcEngine::setRemoteVoicePosition "setRemoteVoicePosition".
  4244. @param enabled Sets whether or not to enable stereo panning for remote users:
  4245. - true: enables stereo panning.
  4246. - false: disables stereo panning.
  4247. @return
  4248. - 0: Success.
  4249. - < 0: Failure.
  4250. */
  4251. virtual int enableSoundPositionIndication(bool enabled) = 0;
  4252. /** Sets the sound position and gain of a remote user.
  4253. When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.
  4254. @note
  4255. - For this method to work, enable stereo panning for remote users by calling the \ref agora::rtc::IRtcEngine::enableSoundPositionIndication "enableSoundPositionIndication" method before joining a channel.
  4256. - This method requires hardware support. For the best sound positioning, we recommend using a stereo speaker.
  4257. @param uid The ID of the remote user.
  4258. @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0:
  4259. - 0.0: the remote sound comes from the front.
  4260. - -1.0: the remote sound comes from the left.
  4261. - 1.0: the remote sound comes from the right.
  4262. @param gain Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain.
  4263. @return
  4264. - 0: Success.
  4265. - < 0: Failure.
  4266. */
  4267. virtual int setRemoteVoicePosition(int uid, double pan, double gain) = 0;
  4268. /** Changes the voice pitch of the local speaker.
  4269. @param pitch Sets the voice pitch. The value ranges between 0.5 and 2.0. The lower the value, the lower the voice pitch. The default value is 1.0 (no change to the local voice pitch).
  4270. @return
  4271. - 0: Success.
  4272. - < 0: Failure.
  4273. */
  4274. virtual int setLocalVoicePitch(double pitch) = 0;
  4275. /** Sets the local voice equalization effect.
  4276. @param bandFrequency Sets the band frequency. The value ranges between 0 and 9, representing the respective 10-band center frequencies of the voice effects, including 31, 62, 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. See #AUDIO_EQUALIZATION_BAND_FREQUENCY.
  4277. @param bandGain Sets the gain of each band in dB. The value ranges between -15 and 15.
  4278. @return
  4279. - 0: Success.
  4280. - < 0: Failure.
  4281. */
  4282. virtual int setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) = 0;
  4283. /** Sets the local voice reverberation.
  4284. v2.4.0 adds the \ref agora::rtc::IRtcEngine::setLocalVoiceReverbPreset "setLocalVoiceReverbPreset" method, a more user-friendly method for setting the local voice reverberation. You can use this method to set the local reverberation effect, such as pop music, R&B, rock music, and hip-hop.
  4285. @param reverbKey Sets the reverberation key. See #AUDIO_REVERB_TYPE.
  4286. @param value Sets the value of the reverberation key.
  4287. @return
  4288. - 0: Success.
  4289. - < 0: Failure.
  4290. */
  4291. virtual int setLocalVoiceReverb(AUDIO_REVERB_TYPE reverbKey, int value) = 0;
  4292. /** Sets the local voice changer option.
  4293. @note Do not use this method together with the \ref agora::rtc::IRtcEngine::setLocalVoiceReverbPreset "setLocalVoiceReverbPreset" method, because the method called later overrides the one called earlier.
  4294. @param voiceChanger Sets the local voice changer option. See #VOICE_CHANGER_PRESET.
  4295. @return
  4296. - 0: Success.
  4297. - < 0: Failure.
  4298. */
  4299. virtual int setLocalVoiceChanger(VOICE_CHANGER_PRESET voiceChanger) = 0;
  4300. /** Sets the preset local voice reverberation effect.
  4301. @note
  4302. - Do not use this method together with \ref agora::rtc::IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb".
  4303. - Do not use this method together with the \ref agora::rtc::IRtcEngine::setLocalVoiceChanger "setLocalVoiceChanger" method, because the method called later overrides the one called earlier.
  4304. @param reverbPreset Sets the preset audio reverberation configuration. See #AUDIO_REVERB_PRESET.
  4305. @return
  4306. - 0: Success.
  4307. - < 0: Failure.
  4308. */
  4309. virtual int setLocalVoiceReverbPreset(AUDIO_REVERB_PRESET reverbPreset) = 0;
  4310. /** Specifies an SDK output log file.
  4311. The log file records all SDK operations during runtime. If it does not exist, the SDK creates one.
  4312. @note
  4313. - The default log file is located at: C:\Users\<user_name>\AppData\Local\Agora\<process_name>.
  4314. - Ensure that you call this method immediately after calling the \ref agora::rtc::IRtcEngine::initialize "initialize" method, otherwise the output log may not be complete.
  4315. @param filePath File path of the log file. The string of the log file is in UTF-8.
  4316. @return
  4317. - 0: Success.
  4318. - < 0: Failure.
  4319. */
  4320. virtual int setLogFile(const char* filePath) = 0;
  4321. /** Sets the output log level of the SDK.
  4322. You can use one or a combination of the log filter levels. The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG. Choose a level to see the logs preceding that level.
  4323. If you set the log level to WARNING, you see the logs within levels CRITICAL, ERROR, and WARNING.
  4324. @param filter Sets the log filter level. See #LOG_FILTER_TYPE.
  4325. @return
  4326. - 0: Success.
  4327. - < 0: Failure.
  4328. */
  4329. virtual int setLogFilter(unsigned int filter) = 0;
  4330. /** Sets the log file size (KB).
  4331. The SDK has two log files, each with a default size of 512 KB. If you set @p fileSizeInBytes as 1024 KB, the SDK outputs log files with a total maximum size of 2 MB. If the total size of the log files exceed the set value, the new output log files overwrite the old output log files.
  4332. @param fileSizeInKBytes The SDK log file size (KB).
  4333. @return
  4334. - 0: Success.
  4335. - <0: Failure.
  4336. */
  4337. virtual int setLogFileSize(unsigned int fileSizeInKBytes) = 0;
  4338. /** Sets the local video display mode.
  4339. This method can be called multiple times during a call to change the display mode.
  4340. @param renderMode Sets the local video display mode. See #RENDER_MODE_TYPE.
  4341. @return
  4342. - 0: Success.
  4343. - < 0: Failure.
  4344. */
  4345. virtual int setLocalRenderMode(RENDER_MODE_TYPE renderMode) = 0;
  4346. /** Sets the video display mode of a specified remote user.
  4347. This method can be called multiple times during a call to change the display mode.
  4348. @param userId ID of the remote user.
  4349. @param renderMode Sets the video display mode. See #RENDER_MODE_TYPE.
  4350. @return
  4351. - 0: Success.
  4352. - < 0: Failure.
  4353. */
  4354. virtual int setRemoteRenderMode(uid_t userId, RENDER_MODE_TYPE renderMode) = 0;
  4355. /** Sets the local video mirror mode.
  4356. You must call this method before calling the \ref agora::rtc::IRtcEngine::startPreview "startPreview" method, otherwise the mirror mode will not work.
  4357. @param mirrorMode Sets the local video mirror mode. See #VIDEO_MIRROR_MODE_TYPE.
  4358. @return
  4359. - 0: Success.
  4360. - < 0: Failure.
  4361. */
  4362. virtual int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) = 0;
  4363. /** Sets the stream mode to the single-stream (default) or dual-stream mode. (Live broadcast only.)
  4364. If the dual-stream mode is enabled, the receiver can choose to receive the high stream (high-resolution and high-bitrate video stream), or the low stream (low-resolution and low-bitrate video stream).
  4365. @param enabled Sets the stream mode:
  4366. - true: Dual-stream mode.
  4367. - false: (Default) Single-stream mode.
  4368. */
  4369. virtual int enableDualStreamMode(bool enabled) = 0;
  4370. /** Sets the external audio source. Please call this method before \ref agora::rtc::IRtcEngine::joinChannel "joinChannel".
  4371. @param enabled Sets whether to enable/disable the external audio source:
  4372. - true: Enables the external audio source.
  4373. - false: (Default) Disables the external audio source.
  4374. @param sampleRate Sets the sample rate of the external audio source, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  4375. @param channels Sets the audio channels of the external audio source (two channels maximum).
  4376. @return
  4377. - 0: Success.
  4378. - < 0: Failure.
  4379. */
  4380. virtual int setExternalAudioSource(bool enabled, int sampleRate, int channels) = 0;
  4381. /** Sets the external audio sink.
  4382. * This method applies to scenarios where you want to use external audio
  4383. * data for playback. After enabling the external audio sink, you can call
  4384. * the \ref agora::media::IMediaEngine::pullAudioFrame "pullAudioFrame" method to pull the remote audio data, process
  4385. * it, and play it with the audio effects that you want.
  4386. *
  4387. * @note
  4388. * Once you enable the external audio sink, the app will not retrieve any
  4389. * audio data from the
  4390. * \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame "onPlaybackAudioFrame" callback.
  4391. *
  4392. * @param enabled
  4393. * - true: Enables the external audio sink.
  4394. * - false: (Default) Disables the external audio sink.
  4395. * @param sampleRate Sets the sample rate of the external audio sink. You
  4396. * can set this parameter as 8000, 16000, 32000, 44100 or 48000.
  4397. * @param channels Sets the number of audio channels of the external
  4398. * audio sink:
  4399. * - 1: Mono.
  4400. * - 2: Stereo.
  4401. *
  4402. * @return
  4403. * - 0: Success.
  4404. * - < 0: Failure.
  4405. */
  4406. virtual int setExternalAudioSink(bool enabled, int sampleRate, int channels) = 0;
  4407. /** Sets the audio recording format for the \ref agora::media::IAudioFrameObserver::onRecordAudioFrame "onRecordAudioFrame" callback.
  4408. @param sampleRate Sets the sample rate (@p samplesPerSec) returned in the *onRecordAudioFrame* callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  4409. @param channel Sets the number of audio channels (@p channels) returned in the *onRecordAudioFrame* callback:
  4410. - 1: Mono
  4411. - 2: Stereo
  4412. @param mode Sets the use mode (see #RAW_AUDIO_FRAME_OP_MODE_TYPE) of the *onRecordAudioFrame* callback.
  4413. @param samplesPerCall Sets the sample points (@p samples) returned in the *onRecordAudioFrame* callback. @p samplesPerCall is usually set as 1024 for stream pushing.
  4414. samplesPerCall = (int)(samplesPerSec &times; sampleInterval &times; numChannels), where sampleInterval &ge; 0.01 in seconds.
  4415. @return
  4416. - 0: Success.
  4417. - < 0: Failure.
  4418. */
  4419. virtual int setRecordingAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) = 0;
  4420. /** Sets the audio playback format for the \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame "onPlaybackAudioFrame" callback.
  4421. @param sampleRate Sets the sample rate (@p samplesPerSec) returned in the *onPlaybackAudioFrame* callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  4422. @param channel Sets the number of channels (@p channels) returned in the *onPlaybackAudioFrame* callback:
  4423. - 1: Mono
  4424. - 2: Stereo
  4425. @param mode Sets the use mode (see #RAW_AUDIO_FRAME_OP_MODE_TYPE) of the *onPlaybackAudioFrame* callback.
  4426. @param samplesPerCall Sets the sample points (*samples*) returned in the *onPlaybackAudioFrame* callback. @p samplesPerCall is usually set as 1024 for stream pushing.
  4427. samplesPerCall = (int)(samplesPerSec &times; sampleInterval &times; numChannels), where sampleInterval &ge; 0.01 in seconds.
  4428. @return
  4429. - 0: Success.
  4430. - < 0: Failure.
  4431. */
  4432. virtual int setPlaybackAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) = 0;
  4433. /** Sets the mixed audio format for the \ref agora::media::IAudioFrameObserver::onMixedAudioFrame "onMixedAudioFrame" callback.
  4434. @param sampleRate Sets the sample rate (@p samplesPerSec) returned in the *onMixedAudioFrame* callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  4435. @param samplesPerCall Sets the sample points (@p samples) returned in the *onMixedAudioFrame* callback. @p samplesPerCall is usually set as 1024 for stream pushing.
  4436. samplesPerCall = (int)(samplesPerSec &times; sampleInterval &times; numChannels), where sampleInterval &ge; 0.01 in seconds.
  4437. @return
  4438. - 0: Success.
  4439. - < 0: Failure.
  4440. */
  4441. virtual int setMixedAudioFrameParameters(int sampleRate, int samplesPerCall) = 0;
  4442. /** Adjusts the recording volume.
  4443. @param volume Recording volume. The value ranges between 0 and 400:
  4444. - 0: Mute.
  4445. - 100: Original volume.
  4446. - 400: (Maximum) Four times the original volume with signal clipping protection.
  4447. @return
  4448. - 0: Success.
  4449. - < 0: Failure.
  4450. */
  4451. virtual int adjustRecordingSignalVolume(int volume) = 0;
  4452. /** Adjusts the playback volume.
  4453. @param volume Playback volume. The value ranges between 0 and 400:
  4454. - 0: Mute.
  4455. - 100: Original volume.
  4456. - 400: (Maximum) Four times the original volume with signal clipping protection.
  4457. @return
  4458. - 0: Success.
  4459. - < 0: Failure.
  4460. */
  4461. virtual int adjustPlaybackSignalVolume(int volume) = 0;
  4462. /** Enables interoperability with the Agora Web SDK.
  4463. @note This method applies only to the Live-broadcast profile. In the Communication profile, interoperability with the Agora Web SDK is enabled by default.
  4464. @param enabled Sets whether to enable/disable interoperability with the Agora Web SDK:
  4465. - true: Enable.
  4466. - false: (Default) Disable.
  4467. @return
  4468. - 0: Success.
  4469. - < 0: Failure.
  4470. */
  4471. virtual int enableWebSdkInteroperability(bool enabled) = 0;
  4472. /** Sets the fallback option for the locally published video stream based on the network conditions.
  4473. The default setting for @p option is #STREAM_FALLBACK_OPTION_DISABLED, where there is no fallback behavior for the locally published video stream when the uplink network conditions are poor.
  4474. If *option* is set as #STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK will:
  4475. - Disable the upstream video but enable audio only when the network conditions worsen and cannot support both video and audio.
  4476. - Re-enable the video when the network conditions improve.
  4477. When the locally published video stream falls back to audio only or when the audio-only stream switches back to the video, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onLocalPublishFallbackToAudioOnly "onLocalPublishFallbackToAudioOnly" callback.
  4478. @note Agora does not recommend using this method for CDN live streaming, because the remote CDN live user will have a noticeable lag when the locally publish stream falls back to audio-only.
  4479. @param option Sets the fallback option for the locally published video stream. See #STREAM_FALLBACK_OPTIONS.
  4480. @return
  4481. - 0: Success.
  4482. - < 0: Failure.
  4483. */
  4484. virtual int setLocalPublishFallbackOption(STREAM_FALLBACK_OPTIONS option) = 0;
  4485. /** Sets the fallback option for the remotely subscribed video stream based on the network conditions.
  4486. The default setting for @p option is #STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW, where the remotely subscribed video stream falls back to the low-stream video (low resolution and low bitrate) under poor downlink network conditions.
  4487. If *option* is set as #STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK automatically switches the video from a high-stream to a low-stream, or disables the video when the downlink network conditions cannot support both audio and video to guarantee the quality of the audio. The SDK monitors the network quality and restores the video stream when the network conditions improve.
  4488. When the remotely subscribed video stream falls back to audio only or when the audio-only stream switches back to the video stream, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onRemoteSubscribeFallbackToAudioOnly "onRemoteSubscribeFallbackToAudioOnly" callback.
  4489. @param option Sets the fallback option for the remotely subscribed video stream. See #STREAM_FALLBACK_OPTIONS.
  4490. @return
  4491. - 0: Success.
  4492. - < 0: Failure.
  4493. */
  4494. virtual int setRemoteSubscribeFallbackOption(STREAM_FALLBACK_OPTIONS option) = 0;
  4495. #if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS)
  4496. /** Switches between front and rear cameras.
  4497. @note This method is for Android and iOS only.
  4498. @return
  4499. - 0: Success.
  4500. - < 0: Failure.
  4501. */
  4502. virtual int switchCamera() = 0;
  4503. /** Sets the default audio playback route.
  4504. This method sets whether the received audio is routed to the earpiece or speakerphone by default before joining a channel.
  4505. If a user does not call this method, the audio is routed to the earpiece by default. If you need to change the default audio route after joining a channel, call the \ref IRtcEngine::setEnableSpeakerphone "setEnableSpeakerphone" method.
  4506. The default setting for each mode:
  4507. - Voice: Earpiece.
  4508. - Video: Speakerphone. If a user who is in the Communication profile calls the \ref IRtcEngine::disableVideo "disableVideo" method or if the user calls the \ref IRtcEngine::muteLocalVideoStream "muteLocalVideoStream" and \ref IRtcEngine::muteAllRemoteVideoStreams "muteAllRemoteVideoStreams" methods, the default audio route switches back to the earpiece automatically.
  4509. - Live Broadcast: Speakerphone.
  4510. - Gaming Voice: Speakerphone.
  4511. @note
  4512. - This method is for Android and iOS only.
  4513. - This method only works in audio mode.
  4514. - Call this method before calling the \ref IRtcEngine::joinChannel "joinChannel" method.
  4515. - Regardless of whether the audio is routed to the speakerphone or earpiece by default, once a headset is plugged in or Bluetooth device is connected, the default audio route changes. The default audio route switches to the earpiece once removing the headset or disconnecting the Bluetooth device.
  4516. @param defaultToSpeaker Sets the default audio route:
  4517. - true: Speakerphone.
  4518. - false: (Default) Earpiece.
  4519. @return
  4520. - 0: Success.
  4521. - < 0: Failure.
  4522. */
  4523. virtual int setDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker) = 0;
  4524. /** Enables/Disables the audio playback route to the speakerphone.
  4525. This method sets whether the audio is routed to the speakerphone or earpiece.
  4526. See the default audio route explanation in the \ref IRtcEngine::setDefaultAudioRouteToSpeakerphone "setDefaultAudioRouteToSpeakerphone" method and check whether it is necessary to call this method.
  4527. @note
  4528. - This method is for Android and iOS only.
  4529. - Ensure that you have successfully called the \ref IRtcEngine::joinChannel "joinChannel" method before calling this method.
  4530. - After calling this method, the SDK returns the \ref IRtcEngineEventHandler::onAudioRouteChanged "onAudioRouteChanged" callback to indicate the changes.
  4531. - This method does not take effect if a headset is used.
  4532. @param speakerOn Sets whether to route the audio to the speakerphone or earpiece:
  4533. - true: Route the audio to the speakerphone.
  4534. - false: Route the audio to the earpiece.
  4535. @return
  4536. - 0: Success.
  4537. - < 0: Failure.
  4538. */
  4539. virtual int setEnableSpeakerphone(bool speakerOn) = 0;
  4540. /** Sets the volume of the in-ear monitor.
  4541. @param volume Sets the volume of the in-ear monitor. The value ranges between 0 and 100 (default).
  4542. @note This method is for Android and iOS only.
  4543. @return
  4544. - 0: Success.
  4545. - < 0: Failure.
  4546. */
  4547. virtual int setInEarMonitoringVolume(int volume) = 0;
  4548. /** Checks whether the speakerphone is enabled.
  4549. @note This method is for Android and iOS only.
  4550. @return
  4551. - 0: Success.
  4552. - < 0: Failure.
  4553. */
  4554. virtual bool isSpeakerphoneEnabled() = 0;
  4555. #endif
  4556. #if (defined(__APPLE__) && TARGET_OS_IOS)
  4557. /** Sets the audio session’s operational restriction.
  4558. The SDK and the app can both configure the audio session by default. The app may occasionally use other apps or third-party components to manipulate the audio session and restrict the SDK from doing so. This method allows the app to restrict the SDK’s manipulation of the audio session.
  4559. You can call this method at any time to return the control of the audio sessions to the SDK.
  4560. @note
  4561. - This method is for iOS only.
  4562. - This method restricts the SDK’s manipulation of the audio session. Any operation to the audio session relies solely on the app, other apps, or third-party components.
  4563. @param restriction The operational restriction (bit mask) of the SDK on the audio session. See #AUDIO_SESSION_OPERATION_RESTRICTION.
  4564. @return
  4565. - 0: Success.
  4566. - < 0: Failure.
  4567. */
  4568. virtual int setAudioSessionOperationRestriction(AUDIO_SESSION_OPERATION_RESTRICTION restriction) = 0;
  4569. #endif
  4570. #if (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(_WIN32)
  4571. /** Enables loopback recording.
  4572. If you enable loopback recording, the output of the sound card is mixed into the audio stream sent to the other end.
  4573. @param enabled Sets whether to enable/disable loopback recording.
  4574. - true: Enable loopback recording.
  4575. - false: (Default) Disable loopback recording.
  4576. @param deviceName Pointer to the device name of the sound card. The default value is NULL (the default sound card).
  4577. @note
  4578. - This method is for macOS and Windows only.
  4579. - macOS does not support loopback recording of the default sound card. If you need to use this method, please use a virtual sound card and pass its name to the deviceName parameter. Agora has tested and recommends using soundflower.
  4580. */
  4581. virtual int enableLoopbackRecording(bool enabled, const char* deviceName = NULL) = 0;
  4582. #if (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
  4583. /** Shares the whole or part of a screen by specifying the display ID.
  4584. @note This method is for macOS and Windows only.
  4585. @param displayId The display ID of the screen to be shared. This parameter specifies which screen you want to share.
  4586. @param regionRect (Optional) Sets the relative location of the region to the screen. NIL means sharing the whole screen. See Rectangle. If the specified region overruns the screen, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen.
  4587. @param captureParams Sets the screen sharing encoding parameters. See ScreenCaptureParameters.
  4588. @return
  4589. - 0: Success.
  4590. - < 0: Failure:
  4591. - ERR_INVALID_STATE: the screen sharing state is invalid, probably because another screen or window is being shared. Call \ref IRtcEngine::stopScreenCapture "stopScreenCapture" to stop the current screen sharing.
  4592. - ERR_INVALID_ARGUMENT: the argument is invalid.
  4593. */
  4594. virtual int startScreenCaptureByDisplayId(unsigned int displayId, const Rectangle& regionRect, const ScreenCaptureParameters& captureParams) = 0;
  4595. #endif
  4596. #if defined(_WIN32)
  4597. /** Shares the whole or part of a screen by specifying the screen rect.
  4598. @param screenRect Sets the relative location of the screen to the virtual screen. For information on how to get screenRect, see [Share the Screen].
  4599. @param regionRect (Optional) Sets the relative location of the region to the screen. NULL means sharing the whole screen. See Rectangle. If the specified region overruns the screen, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen.
  4600. @param captureParams Sets the screen sharing encoding parameters. See ScreenCaptureParameters.
  4601. @return
  4602. - 0: Success.
  4603. - < 0: Failure:
  4604. - ERR_INVALID_STATE: the screen sharing state is invalid, probably because another screen or window is being shared. Call stopScreenCapture to stop the current screen sharing.
  4605. - ERR_INVALID_ARGUMENT: the argument is invalid.
  4606. */
  4607. virtual int startScreenCaptureByScreenRect(const Rectangle& screenRect, const Rectangle& regionRect, const ScreenCaptureParameters& captureParams) = 0;
  4608. #endif
  4609. /** Shares the whole or part of a window by specifying the window ID.
  4610. @param windowId The ID of the window to be shared. For information on how to get the windowId, see [Share the Window].
  4611. @param regionRect (Optional) The relative location of the region to the window. NULL/NIL means sharing the whole window. See Rectangle. If the specified region overruns the window, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole window.
  4612. @param captureParams Window sharing encoding parameters. See ScreenCaptureParameters.
  4613. @return
  4614. - 0: Success.
  4615. - < 0: Failure:
  4616. - ERR_INVALID_STATE: the window sharing state is invalid, probably because another screen or window is being shared. Call stopScreenCapture to stop sharing the current window.
  4617. - ERR_INVALID_ARGUMENT: the argument is invalid.
  4618. */
  4619. virtual int startScreenCaptureByWindowId(view_t windowId, const Rectangle& regionRect, const ScreenCaptureParameters& captureParams) = 0;
  4620. /** Sets the content hint for screen sharing.
  4621. A content hint suggests the type of the content being shared, so that the SDK applies different optimization algorithm to different types of content.
  4622. @param contentHint Sets the content hint for screen sharing. See VideoContentHint.
  4623. @return
  4624. - 0: Success.
  4625. - < 0: Failure.
  4626. */
  4627. virtual int setScreenCaptureContentHint(VideoContentHint contentHint) = 0;
  4628. /** Updates the screen sharing parameters.
  4629. @param captureParams Sets the screen sharing encoding parameters. See ScreenCaptureParameters.
  4630. @return
  4631. - 0: Success.
  4632. - < 0: Failure:
  4633. - ERR_NOT_READY: no screen or windows is being shared.
  4634. */
  4635. virtual int updateScreenCaptureParameters(const ScreenCaptureParameters& captureParams) = 0;
  4636. /** Updates the screen sharing region.
  4637. @param regionRect Sets the relative location of the region to the screen or window. NULL means sharing the whole screen or window. See Rectangle. If the specified region overruns the screen or window, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen or window.
  4638. @return
  4639. - 0: Success.
  4640. - < 0: Failure:
  4641. - ERR_NOT_READY: no screen or window is being shared.
  4642. */
  4643. virtual int updateScreenCaptureRegion(const Rectangle& regionRect) = 0;
  4644. /** Stop screen sharing.
  4645. @return
  4646. - 0: Success.
  4647. - < 0: Failure.
  4648. */
  4649. virtual int stopScreenCapture() = 0;
  4650. #if defined(__APPLE__)
  4651. typedef unsigned int WindowIDType;
  4652. #elif defined(_WIN32)
  4653. typedef HWND WindowIDType;
  4654. #endif
  4655. /** **DEPRECATED** Starts screen sharing.
  4656. This method is deprecated as of v2.4.0. See the following methods instead:
  4657. - \ref agora::rtc::IRtcEngine::startScreenCaptureByDisplayId "startScreenCaptureByDisplayId"
  4658. - \ref agora::rtc::IRtcEngine::startScreenCaptureByScreenRect "startScreenCaptureByScreenRect"
  4659. - \ref agora::rtc::IRtcEngine::startScreenCaptureByWindowId "startScreenCaptureByWindowId"
  4660. This method shares the whole screen, specified window, or specified region:
  4661. - Whole screen: Set @p windowId as 0 and @p rect as NULL.
  4662. - Specified window: Set @p windowId as a value other than 0. Each window has a @p windowId that is not 0.
  4663. - Specified region: Set @p windowId as 0 and @p rect not as NULL. In this case, you can share the specified region, for example by dragging the mouse or implementing your own logic.
  4664. @note The specified region is a region on the whole screen. Currently, sharing a specified region in a specific window is not supported.
  4665. *captureFreq* is the captured frame rate once the screen-sharing function is enabled. The mandatory value ranges between 1 fps and 15 fps.
  4666. @param windowId Sets the screen sharing area. See WindowIDType.
  4667. @param captureFreq (Mandatory) The captured frame rate. The value ranges between 1 fps and 15 fps.
  4668. @param rect Specifies the screen-sharing region. @p rect is valid when @p windowsId is set as 0. When @p rect is set as NULL, the whole screen is shared.
  4669. @param bitrate The captured bitrate.
  4670. @return
  4671. - 0: Success.
  4672. - < 0: Failure.
  4673. */
  4674. virtual int startScreenCapture(WindowIDType windowId, int captureFreq, const Rect *rect, int bitrate) = 0;
  4675. /** **DEPRECATED** Updates the screen capture region.
  4676. @param rect Specifies the required region inside the screen or window.
  4677. @return
  4678. - 0: Success.
  4679. - < 0: Failure.
  4680. */
  4681. virtual int updateScreenCaptureRegion(const Rect *rect) = 0;
  4682. #endif
  4683. /** Retrieves the current call ID.
  4684. When a user joins a channel on a client, a @p callId is generated to identify the call from the client. Feedback methods, such as \ref IRtcEngine::rate "rate" and \ref IRtcEngine::complain "complain", must be called after the call ends to submit feedback to the SDK.
  4685. The \ref IRtcEngine::rate "rate" and \ref IRtcEngine::complain "complain" methods require the @p callId parameter retrieved from the *getCallId* method during a call. @p callId is passed as an argument into the \ref IRtcEngine::rate "rate" and \ref IRtcEngine::complain "complain" methods after the call ends.
  4686. @param callId Pointer to the current call ID.
  4687. @return
  4688. - 0: Success.
  4689. - < 0: Failure.
  4690. */
  4691. virtual int getCallId(agora::util::AString& callId) = 0;
  4692. /** Allows a user to rate a call after the call ends.
  4693. @param callId Pointer to the ID of the call, retrieved from the \ref IRtcEngine::getCallId "getCallId" method.
  4694. @param rating Rating of the call. The value is between 1 (lowest score) and 5 (highest score). If you set a value out of this range, the #ERR_INVALID_ARGUMENT (2) error returns.
  4695. @param description (Optional) Pointer to the description of the rating, with a string length of less than 800 bytes.
  4696. @return
  4697. - 0: Success.
  4698. - < 0: Failure.
  4699. */
  4700. virtual int rate(const char* callId, int rating, const char* description) = 0;
  4701. /** Allows a user to complain about the call quality after a call ends.
  4702. @param callId Pointer to the ID of the call, retrieved from the \ref IRtcEngine::getCallId "getCallId" method.
  4703. @param description (Optional) Pointer to the description of the complaint, with a string length of less than 800 bytes.
  4704. @return
  4705. - 0: Success.
  4706. - < 0: Failure.
  4707. */
  4708. virtual int complain(const char* callId, const char* description) = 0;
  4709. /** Retrieves the SDK version number.
  4710. @param build Pointer to the build number.
  4711. @return The version of the current SDK in the string format. For example, 2.3.1.
  4712. */
  4713. virtual const char* getVersion(int* build) = 0;
  4714. /** Enables the network connection quality test.
  4715. This method tests the quality of the users' network connections and is disabled by default.
  4716. Before a user joins a channel or before an audience switches to a host, call this method to check the uplink network quality.
  4717. This method consumes additional network traffic, and hence may affect communication quality.
  4718. Call the \ref IRtcEngine::disableLastmileTest "disableLastmileTest" method to disable this test after receiving the \ref IRtcEngineEventHandler::onLastmileQuality "onLastmileQuality" callback, and before joining a channel.
  4719. @note
  4720. - Do not call any other methods before receiving the \ref IRtcEngineEventHandler::onLastmileQuality "onLastmileQuality" callback. Otherwise, the callback may be interrupted by other methods, and hence may not be triggered.
  4721. - A host should not call this method after joining a channel (when in a call).
  4722. @return
  4723. - 0: Success.
  4724. - < 0: Failure.
  4725. */
  4726. virtual int enableLastmileTest() = 0;
  4727. /** Disables the network connection quality test.
  4728. @return
  4729. - 0: Success.
  4730. - < 0: Failure.
  4731. */
  4732. virtual int disableLastmileTest() = 0;
  4733. /** Starts the last-mile network probe test.
  4734. This method starts the last-mile network probe test before joining a channel to get the uplink and downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT).
  4735. Call this method to check the uplink network quality before users join a channel or before an audience switches to a host.
  4736. Once this method is enabled, the SDK returns the following callbacks:
  4737. - \ref IRtcEngineEventHandler::onLastmileQuality "onLastmileQuality": the SDK triggers this callback within two seconds depending on the network conditions. This callback rates the network conditions and is more closely linked to the user experience.
  4738. - \ref IRtcEngineEventHandler::onLastmileProbeResult "onLastmileProbeResult": the SDK triggers this callback within 30 seconds depending on the network conditions. This callback returns the real-time statistics of the network conditions and is more objective.
  4739. @note
  4740. - This method consumes extra network traffic and may affect communication quality. We do not recommend calling this method together with enableLastmileTest.
  4741. - Do not call other methods before receiving the \ref IRtcEngineEventHandler::onLastmileQuality "onLastmileQuality" and \ref IRtcEngineEventHandler::onLastmileProbeResult "onLastmileProbeResult" callbacks. Otherwise, the callbacks may be interrupted.
  4742. - In the Live-broadcast profile, a host should not call this method after joining a channel.
  4743. @param config Sets the configurations of the last-mile network probe test. See LastmileProbeConfig.
  4744. @return
  4745. - 0: Success.
  4746. - < 0: Failure.
  4747. */
  4748. virtual int startLastmileProbeTest(const LastmileProbeConfig& config) = 0;
  4749. /** Stops the last-mile network probe test. */
  4750. virtual int stopLastmileProbeTest() = 0;
  4751. /** Retrieves the warning or error description.
  4752. @return code #WARN_CODE_TYPE or #ERROR_CODE_TYPE returned in the \ref IRtcEngineEventHandler::onWarning "onWarning" or \ref IRtcEngineEventHandler::onError "onError" callback.
  4753. */
  4754. virtual const char* getErrorDescription(int code) = 0;
  4755. /** Enables built-in encryption with an encryption password before users join a channel.
  4756. All users in a channel must use the same encryption password. The encryption password is automatically cleared once a user leaves the channel.
  4757. If an encryption password is not specified, the encryption functionality will be disabled.
  4758. @note
  4759. - Do not use this method for CDN live streaming.
  4760. - For optimal transmission, ensure that the encrypted data size does not exceed the original data size + 16 bytes. 16 bytes is the maximum padding size for AES encryption.
  4761. @param secret Pointer to the encryption password.
  4762. @return
  4763. - 0: Success.
  4764. - < 0: Failure.
  4765. */
  4766. virtual int setEncryptionSecret(const char* secret) = 0;
  4767. /** Sets the built-in encryption mode.
  4768. The Agora SDK supports built-in encryption, which is set to the @p aes-128-xts mode by default. Call this method to use other encryption modes.
  4769. All users in the same channel must use the same encryption mode and password.
  4770. Refer to the information related to the AES encryption algorithm on the differences between the encryption modes.
  4771. @note Call the \ref IRtcEngine::setEncryptionSecret "setEncryptionSecret" method to enable the built-in encryption function before calling this method.
  4772. @param encryptionMode Pointer to the set encryption mode:
  4773. - "aes-128-xts": (Default) 128-bit AES encryption, XTS mode.
  4774. - "aes-128-ecb": 128-bit AES encryption, ECB mode.
  4775. - "aes-256-xts": 256-bit AES encryption, XTS mode.
  4776. - "": When encryptionMode is set as NULL, the encryption mode is set as "aes-128-xts" by default.
  4777. @return
  4778. - 0: Success.
  4779. - < 0: Failure.
  4780. */
  4781. virtual int setEncryptionMode(const char* encryptionMode) = 0;
  4782. /** Registers a packet observer.
  4783. The Agora SDK allows your application to register a packet observer to receive callbacks for voice or video packet transmission.
  4784. @param observer Pointer to the registered packet observer. See IPacketObserver.
  4785. @return
  4786. - 0: Success.
  4787. - < 0: Failure.
  4788. */
  4789. virtual int registerPacketObserver(IPacketObserver* observer) = 0;
  4790. /** Creates a data stream.
  4791. Each user can create up to five data streams during the lifecycle of the RtcEngine.
  4792. @note Set both the @p reliable and @p ordered parameters to true or false. Do not set one as true and the other as false.
  4793. @param streamId Pointer to the ID of the created data stream.
  4794. @param reliable Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds:
  4795. - true: The recipients receive the data stream from the sender within five seconds. If the recipient does not receive the data stream within five seconds, an error is reported to the application.
  4796. - false: There is no guarantee that the recipients receive the data stream within five seconds and no error message is reported for any delay or missing data stream.
  4797. @param ordered Sets whether or not the recipients receive the data stream in the sent order:
  4798. - true: The recipients receive the data stream in the sent order.
  4799. - false: The recipients do not receive the data stream in the sent order.
  4800. @return
  4801. - Returns 0: Success.
  4802. - < 0: Failure.
  4803. */
  4804. virtual int createDataStream(int* streamId, bool reliable, bool ordered) = 0;
  4805. /** Sends data stream messages to all users in a channel.
  4806. The SDK has the following restrictions on this method:
  4807. - Up to 30 packets can be sent per second in a channel with each packet having a maximum size of 1 kB.
  4808. - Each client can send up to 6 kB of data per second.
  4809. - Each user can have up to five data streams simultaneously.
  4810. A successful \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onStreamMessage "onStreamMessage" callback on the remote client, from which the remote user gets the stream message.
  4811. A failed \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onStreamMessageError "onStreamMessage" callback on the remote client.
  4812. @note This method applies only to the Communication profile or to the hosts in the Live-broadcast profile. If an audience in the Live-broadcast profile calls this method, the audience may be switched to a host.
  4813. @param streamId ID of the sent data stream, returned in the \ref IRtcEngine::createDataStream "createDataStream" method.
  4814. @param data Pointer to the sent data.
  4815. @param length Length of the sent data.
  4816. @return
  4817. - 0: Success.
  4818. - < 0: Failure.
  4819. */
  4820. virtual int sendStreamMessage(int streamId, const char* data, size_t length) = 0;
  4821. /** Publishes the local stream to a specified CDN live RTMP address. (CDN live only.)
  4822. The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback.
  4823. The \ref agora::rtc::IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of adding a local stream to the CDN.
  4824. @note
  4825. - Ensure that the user joins the channel before calling this method.
  4826. - This method adds only one stream RTMP URL address each time it is called.
  4827. - The RTMP URL address must not contain special characters, such as Chinese language characters.
  4828. - This method applies to Live Broadcast only.
  4829. @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes.
  4830. @param transcodingEnabled Sets whether transcoding is enabled/disabled:
  4831. - true: Enable transcoding. To [transcode](https://docs.agora.io/en/Agora%20Platform/terms?platform=All%20Platforms#transcoding) the audio or video streams when publishing them to CDN live, often used for combining the audio and video streams of multiple hosts in CDN live.
  4832. - false: Disable transcoding.
  4833. @return
  4834. - 0: Success.
  4835. - < 0: Failure.
  4836. - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0.
  4837. - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.
  4838. */
  4839. virtual int addPublishStreamUrl(const char *url, bool transcodingEnabled) = 0;
  4840. /** Removes an RTMP stream from the CDN. (CDN live only.)
  4841. This method removes the RTMP URL address (added by the \ref IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" method) from a CDN live stream. The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamUnpublished "onStreamUnpublished" callback.
  4842. The \ref agora::rtc::IRtcEngine::removePublishStreamUrl "removePublishStreamUrl" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of removing an RTMP stream from the CDN.
  4843. @note
  4844. - This method removes only one RTMP URL address each time it is called.
  4845. - The RTMP URL address must not contain special characters, such as Chinese language characters.
  4846. - This method applies to Live Broadcast only.
  4847. @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes.
  4848. @return
  4849. - 0: Success.
  4850. - < 0: Failure.
  4851. */
  4852. virtual int removePublishStreamUrl(const char *url) = 0;
  4853. /** Sets the video layout and audio settings for CDN live. (CDN live only.)
  4854. @note This method applies to Live Broadcast only.
  4855. @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding.
  4856. @return
  4857. - 0: Success.
  4858. - < 0: Failure.
  4859. */
  4860. virtual int setLiveTranscoding(const LiveTranscoding &transcoding) = 0;
  4861. /** Adds a watermark image to the local video or CDN live stream.
  4862. This method adds a PNG watermark image to the local video stream for the recording device, channel audience, and CDN live audience to view and capture.
  4863. To add the PNG file to the CDN live publishing stream, see the \ref IRtcEngine::setLiveTranscoding "setLiveTranscoding" method.
  4864. @param watermark Pointer to the watermark image to be added to the local video stream. See RtcImage.
  4865. @note
  4866. - The URL descriptions are different for the local video and CDN live streams:
  4867. - In a local video stream, @p url in RtcImage refers to the absolute path of the added watermark image file in the local video stream.
  4868. - In a CDN live stream, @p url in RtcImage refers to the URL address of the added watermark image in the CDN live broadcast.
  4869. - The source file of the watermark image must be in the PNG file format. If the width and height of the PNG file differ from your settings in this method, the PNG file will be cropped to conform to your settings.
  4870. - The Agora SDK supports adding only one watermark image onto a local video or CDN live stream. The newly added watermark image replaces the previous one.
  4871. @return
  4872. - 0: Success.
  4873. - < 0: Failure.
  4874. */
  4875. virtual int addVideoWatermark(const RtcImage& watermark) = 0;
  4876. /** Removes the watermark image from the video stream added by the \ref IRtcEngine::addVideoWatermark "addVideoWatermark" method.
  4877. @return
  4878. - 0: Success.
  4879. - < 0: Failure.
  4880. */
  4881. virtual int clearVideoWatermarks() = 0;
  4882. /** **Supports Android and iOS only!** Enables/Disables image enhancement and sets the options.
  4883. @param enabled Sets whether or not to enable image enhancement:
  4884. - true: enables image enhancement.
  4885. - false: disables image enhancement.
  4886. @param options Sets the image enhancement option. See BeautyOptions.
  4887. */
  4888. virtual int setBeautyEffectOptions(bool enabled, BeautyOptions options) = 0;
  4889. /** Adds a voice or video stream URL address to a live broadcast.
  4890. The \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback returns the inject status. If this method call is successful, the server pulls the voice or video stream and injects it into a live channel. This is applicable to scenarios where all audience members in the channel can watch a live show and interact with each other.
  4891. @note
  4892. - Contact support@agora.io to enable the CDN streaming function before calling this method.
  4893. - This method applies to the Native SDK v2.4.1 and later.
  4894. The \ref agora::rtc::IRtcEngine::addInjectStreamUrl "addInjectStreamUrl" method call triggers the following callbacks:
  4895. - The local client:
  4896. - \ref agora::rtc::IRtcEngineEventHandler::onStreamInjectedStatus "onStreamInjectedStatus" , with the state of the injecting the online stream.
  4897. - \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" (uid: 666), if the method call is successful and the online media stream is injected into the channel.
  4898. - The remote client:
  4899. - \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" (uid: 666), if the method call is successful and the online media stream is injected into the channel.
  4900. @param url Pointer to the URL address to be added to the ongoing live broadcast. Valid protocols are RTMP, HLS, and FLV.
  4901. - Supported FLV audio codec type: AAC.
  4902. - Supported FLV video codec type: H264 (AVC).
  4903. @param config Pointer to the InjectStreamConfig object that contains the configuration of the added voice or video stream.
  4904. @return
  4905. - 0: Success.
  4906. - < 0: Failure.
  4907. - #ERR_INVALID_ARGUMENT (2): The injected URL does not exist. Call this method again to inject the stream and ensure that the URL is valid.
  4908. - #ERR_NOT_READY (3): The user is not in the channel.
  4909. - #ERR_NOT_SUPPORTED (4): The channel profile is not live broadcast. Call the \ref agora::rtc::IRtcEngine::setChannelProfile "setChannelProfile" method and set the channel profile to live broadcast before calling this method.
  4910. - #ERR_NOT_INITIALIZED (7): The SDK is not initialized. Ensure that the IRtcEngine object is initialized before calling this method.
  4911. */
  4912. virtual int addInjectStreamUrl(const char* url, const InjectStreamConfig& config) = 0;
  4913. /** Starts to relay media streams across channels.
  4914. *
  4915. * After a successful method call, the SDK triggers the
  4916. * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged
  4917. * "onChannelMediaRelayStateChanged" and
  4918. * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayEvent
  4919. * "onChannelMediaRelayEvent" callbacks, and these callbacks return the
  4920. * state and events of the media stream relay.
  4921. * - If the
  4922. * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged
  4923. * "onChannelMediaRelayStateChanged" callback returns
  4924. * #RELAY_STATE_RUNNING (1) and #RELAY_OK (0), and the
  4925. * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayEvent
  4926. * "onChannelMediaRelayEvent" callback returns
  4927. * #RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL (4), the broadcaster starts
  4928. * sending data to the destination channel.
  4929. * - If the
  4930. * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged
  4931. * "onChannelMediaRelayStateChanged" callback returns
  4932. * #RELAY_STATE_FAILURE (3), an exception occurs during the media stream
  4933. * relay.
  4934. *
  4935. * @note
  4936. * - Call this method after the \ref joinChannel() "joinChannel" method.
  4937. * - This method takes effect only when you are a broadcaster in a
  4938. * Live-broadcast channel.
  4939. * - After a successful method call, if you want to call this method
  4940. * again, ensure that you call the
  4941. * \ref stopChannelMediaRelay() "stopChannelMediaRelay" method to quit the
  4942. * current relay.
  4943. *
  4944. * @param configuration The configuration of the media stream relay:
  4945. * ChannelMediaRelayConfiguration.
  4946. *
  4947. * @return
  4948. * - 0: Success.
  4949. * - < 0: Failure.
  4950. */
  4951. virtual int startChannelMediaRelay(const ChannelMediaRelayConfiguration &configuration) = 0;
  4952. /** Updates the channels for media stream relay. After a successful
  4953. * \ref startChannelMediaRelay() "startChannelMediaRelay" method call, if
  4954. * you want to relay the media stream to more channels, or leave the
  4955. * current relay channel, you can call the
  4956. * \ref updateChannelMediaRelay() "updateChannelMediaRelay" method.
  4957. *
  4958. * After a successful method call, the SDK triggers the
  4959. * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged
  4960. * "onChannelMediaRelayStateChanged" callback with the
  4961. * #RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL (7) state code.
  4962. *
  4963. * @note
  4964. * Call this method after the
  4965. * \ref startChannelMediaRelay() "startChannelMediaRelay" method to update
  4966. * the destination channel.
  4967. *
  4968. * @param configuration The media stream relay configuration:
  4969. * ChannelMediaRelayConfiguration.
  4970. *
  4971. * @return
  4972. * - 0: Success.
  4973. * - < 0: Failure.
  4974. */
  4975. virtual int updateChannelMediaRelay(const ChannelMediaRelayConfiguration &configuration) = 0;
  4976. /** Stops the media stream relay.
  4977. *
  4978. * Once the relay stops, the broadcaster quits all the destination
  4979. * channels.
  4980. *
  4981. * After a successful method call, the SDK triggers the
  4982. * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged
  4983. * "onChannelMediaRelayStateChanged" callback. If the callback returns
  4984. * #RELAY_STATE_IDLE (0) and #RELAY_OK (0), the broadcaster successfully
  4985. * stops the relay.
  4986. *
  4987. * @note
  4988. * If the method call fails, the SDK triggers the
  4989. * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged
  4990. * "onChannelMediaRelayStateChanged" callback with the
  4991. * #RELAY_ERROR_SERVER_NO_RESPONSE (2) or
  4992. * #RELAY_ERROR_SERVER_CONNECTION_LOST (8) state code. You can leave the
  4993. * channel by calling the \ref leaveChannel() "leaveChannel" method, and
  4994. * the media stream relay automatically stops.
  4995. *
  4996. * @return
  4997. * - 0: Success.
  4998. * - < 0: Failure.
  4999. */
  5000. virtual int stopChannelMediaRelay() = 0;
  5001. /** Removes the voice or video stream URL address from a live broadcast.
  5002. This method removes the URL address (added by the \ref IRtcEngine::addInjectStreamUrl "addInjectStreamUrl" method) from the live broadcast.
  5003. @note If this method is called successfully, the SDK triggers the \ref IRtcEngineEventHandler::onUserOffline "onUserOffline" callback and returns a stream uid of 666.
  5004. @param url Pointer to the URL address of the added stream to be removed.
  5005. @return
  5006. - 0: Success.
  5007. - < 0: Failure.
  5008. */
  5009. virtual int removeInjectStreamUrl(const char* url) = 0;
  5010. virtual bool registerEventHandler(IRtcEngineEventHandler *eventHandler) = 0;
  5011. virtual bool unregisterEventHandler(IRtcEngineEventHandler *eventHandler) = 0;
  5012. /** Gets the connection state of the SDK.
  5013. @return #CONNECTION_STATE_TYPE.
  5014. */
  5015. virtual CONNECTION_STATE_TYPE getConnectionState() = 0;
  5016. /** Registers the metadata observer.
  5017. Registers the metadata observer. You need to implement the IMetadataObserver class and specify the metadata type in this method. A successful call of this method triggers the \ref agora::rtc::IMetadataObserver::getMaxMetadataSize "getMaxMetadataSize" callback.
  5018. This method enables you to add synchronized metadata in the video stream for more diversified live broadcast interactions, such as sending shopping links, digital coupons, and online quizzes.
  5019. @note
  5020. - Call this method before the joinChannel method.
  5021. - This method applies to the Live-broadcast channel profile.
  5022. @param observer The IMetadataObserver class. See the definition of IMetadataObserver for details.
  5023. @param type See \ref IMetadataObserver::METADATA_TYPE "METADATA_TYPE". The SDK supports VIDEO_METADATA (0) only for now.
  5024. @return
  5025. - 0: Success.
  5026. - < 0: Failure.
  5027. */
  5028. virtual int registerMediaMetadataObserver(IMetadataObserver *observer, IMetadataObserver::METADATA_TYPE type) = 0;
  5029. };
  5030. class IRtcEngineParameter
  5031. {
  5032. public:
  5033. /**
  5034. * Releases all IRtcEngineParameter resources.
  5035. */
  5036. virtual void release() = 0;
  5037. /** Sets the bool value of a specified key in the JSON format.
  5038. @param key Pointer to the name of the key.
  5039. @param value Sets the value.
  5040. @return
  5041. - 0: Success.
  5042. - < 0: Failure.
  5043. */
  5044. virtual int setBool(const char* key, bool value) = 0;
  5045. /** Sets the int value of a specified key in the JSON format.
  5046. @param key Pointer to the name of the key.
  5047. @param value Sets the value.
  5048. @return
  5049. - 0: Success.
  5050. - < 0: Failure.
  5051. */
  5052. virtual int setInt(const char* key, int value) = 0;
  5053. /** Sets the unsigned int value of a specified key in the JSON format.
  5054. @param key Pointer to the name of the key.
  5055. @param value Sets the value.
  5056. @return
  5057. - 0: Success.
  5058. - < 0: Failure.
  5059. */
  5060. virtual int setUInt(const char* key, unsigned int value) = 0;
  5061. /** Sets the double value of a specified key in the JSON format.
  5062. @param key Pointer to the name of the key.
  5063. @param value Sets the value.
  5064. @return
  5065. - 0: Success.
  5066. - < 0: Failure.
  5067. */
  5068. virtual int setNumber(const char* key, double value) = 0;
  5069. /** Sets the string value of a specified key in the JSON format.
  5070. @param key Pointer to the name of the key.
  5071. @param value Pointer to the set value.
  5072. @return
  5073. - 0: Success.
  5074. - < 0: Failure.
  5075. */
  5076. virtual int setString(const char* key, const char* value) = 0;
  5077. /** Sets the object value of a specified key in the JSON format.
  5078. @param key Pointer to the name of the key.
  5079. @param value Pointer to the set value.
  5080. @return
  5081. - 0: Success.
  5082. - < 0: Failure.
  5083. */
  5084. virtual int setObject(const char* key, const char* value) = 0;
  5085. /** Retrieves the bool value of a specified key in the JSON format.
  5086. @param key Pointer to the name of the key.
  5087. @param value Pointer to the retrieved value.
  5088. @return
  5089. - 0: Success.
  5090. - < 0: Failure.
  5091. */
  5092. virtual int getBool(const char* key, bool& value) = 0;
  5093. /** Retrieves the int value of the JSON format.
  5094. @param key Pointer to the name of the key.
  5095. @param value Pointer to the retrieved value.
  5096. @return
  5097. - 0: Success.
  5098. - < 0: Failure.
  5099. */
  5100. virtual int getInt(const char* key, int& value) = 0;
  5101. /** Retrieves the unsigned int value of a specified key in the JSON format.
  5102. @param key Pointer to the name of the key.
  5103. @param value Pointer to the retrieved value.
  5104. @return
  5105. - 0: Success.
  5106. - < 0: Failure.
  5107. */
  5108. virtual int getUInt(const char* key, unsigned int& value) = 0;
  5109. /** Retrieves the double value of a specified key in the JSON format.
  5110. @param key Pointer to the name of the key.
  5111. @param value Pointer to the retrieved value.
  5112. @return
  5113. - 0: Success.
  5114. - < 0: Failure.
  5115. */
  5116. virtual int getNumber(const char* key, double& value) = 0;
  5117. /** Retrieves the string value of a specified key in the JSON format.
  5118. @param key Pointer to the name of the key.
  5119. @param value Pointer to the retrieved value.
  5120. @return
  5121. - 0: Success.
  5122. - < 0: Failure.
  5123. */
  5124. virtual int getString(const char* key, agora::util::AString& value) = 0;
  5125. /** Retrieves a child object value of a specified key in the JSON format.
  5126. @param key Pointer to the name of the key.
  5127. @param value Pointer to the retrieved value.
  5128. @return
  5129. - 0: Success.
  5130. - < 0: Failure.
  5131. */
  5132. virtual int getObject(const char* key, agora::util::AString& value) = 0;
  5133. /** Retrieves the array value of a specified key in the JSON format.
  5134. @param key Pointer to the name of the key.
  5135. @param value Pointer to the retrieved value.
  5136. @return
  5137. - 0: Success.
  5138. - < 0: Failure.
  5139. */
  5140. virtual int getArray(const char* key, agora::util::AString& value) = 0;
  5141. /** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options.
  5142. @param parameters Pointer to the set parameters in a JSON string.
  5143. @return
  5144. - 0: Success.
  5145. - < 0: Failure.
  5146. */
  5147. virtual int setParameters(const char* parameters) = 0;
  5148. /** Sets the profile to control the RTC engine.
  5149. @param profile Pointer to the set profile.
  5150. @param merge Sets whether to merge the profile data with the original value:
  5151. - true: Merge the profile data with the original value.
  5152. - false: Do not merge the profile data with the original value.
  5153. @return
  5154. - 0: Success.
  5155. - < 0: Failure.
  5156. */
  5157. virtual int setProfile(const char* profile, bool merge) = 0;
  5158. virtual int convertPath(const char* filePath, agora::util::AString& value) = 0;
  5159. };
  5160. class AAudioDeviceManager : public agora::util::AutoPtr<IAudioDeviceManager>
  5161. {
  5162. public:
  5163. AAudioDeviceManager(IRtcEngine* engine)
  5164. {
  5165. queryInterface(engine, AGORA_IID_AUDIO_DEVICE_MANAGER);
  5166. }
  5167. };
  5168. class AVideoDeviceManager : public agora::util::AutoPtr<IVideoDeviceManager>
  5169. {
  5170. public:
  5171. AVideoDeviceManager(IRtcEngine* engine)
  5172. {
  5173. queryInterface(engine, AGORA_IID_VIDEO_DEVICE_MANAGER);
  5174. }
  5175. };
  5176. class AParameter : public agora::util::AutoPtr<IRtcEngineParameter>
  5177. {
  5178. public:
  5179. AParameter(IRtcEngine& engine) { initialize(&engine); }
  5180. AParameter(IRtcEngine* engine) { initialize(engine); }
  5181. AParameter(IRtcEngineParameter* p) :agora::util::AutoPtr<IRtcEngineParameter>(p) {}
  5182. private:
  5183. bool initialize(IRtcEngine* engine)
  5184. {
  5185. IRtcEngineParameter* p = NULL;
  5186. if (engine && !engine->queryInterface(AGORA_IID_RTC_ENGINE_PARAMETER, (void**)&p))
  5187. reset(p);
  5188. return p != NULL;
  5189. }
  5190. };
  5191. /** The RtcEngineParameters class is an auxiliary class setting parameters for the SDK.
  5192. */
  5193. class RtcEngineParameters
  5194. {
  5195. public:
  5196. RtcEngineParameters(IRtcEngine& engine)
  5197. :m_parameter(&engine){}
  5198. RtcEngineParameters(IRtcEngine* engine)
  5199. :m_parameter(engine){}
  5200. /** Disables/Re-enables the local video.
  5201. This method is only applicable when the user wants to watch the remote video without sending any video stream to the other user.
  5202. Call this method after calling the \ref agora::rtc::IRtcEngine::enableVideo "enableVideo" method. Otherwise, this method may not work properly.
  5203. After the *enableVideo* method is called, the local video is enabled by default. This method is used to disable/re-enable the local video while the remote video remains unaffected.
  5204. @note This method affects the internal engine and can be called after the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method.
  5205. @param enabled Sets whether to disable/re-enable the local video, including the capturer, renderer, and sender:
  5206. - true: (Default) Re-enable the local video.
  5207. - false: Disable the local video. Once the local video is disabled, the remote users can no longer receive the video stream of this user, while this user can still receive the video streams of the other remote users.
  5208. @return
  5209. - 0: Success.
  5210. - < 0: Failure.
  5211. */
  5212. int enableLocalVideo(bool enabled) {
  5213. return setParameters("{\"rtc.video.capture\":%s,\"che.video.local.capture\":%s,\"che.video.local.render\":%s,\"che.video.local.send\":%s}", enabled ? "true" : "false", enabled ? "true" : "false", enabled ? "true" : "false", enabled ? "true" : "false");
  5214. }
  5215. /** Stops/Resumes sending the local video stream.
  5216. @note When set to *true*, this method does not disable the camera which does not affect the retrieval of the local video streams. This method executes faster than the \ref agora::rtc::IRtcEngine::enableLocalVideo "enableLocalVideo" method which controls the sending of the local video stream.
  5217. @param mute Sets whether to send/stop sending the local video stream:
  5218. - true: Stop sending the local video stream.
  5219. - false: (Default) Send the local video stream.
  5220. @return
  5221. - 0: Success.
  5222. - < 0: Failure.
  5223. */
  5224. int muteLocalVideoStream(bool mute) {
  5225. return setParameters("{\"rtc.video.mute_me\":%s,\"che.video.local.send\":%s}", mute ? "true" : "false", mute ? "false" : "true");
  5226. }
  5227. /** Stops/Resumes receiving all remote users' video streams.
  5228. @param mute Sets whether to receive/stop receiving all remote users' video streams:
  5229. - true: Stop receiving all remote users' video streams.
  5230. - false: (Default) Receive all remote users' video streams.
  5231. @return
  5232. - 0: Success.
  5233. - < 0: Failure.
  5234. */
  5235. int muteAllRemoteVideoStreams(bool mute) {
  5236. return m_parameter ? m_parameter->setBool("rtc.video.mute_peers", mute) : -ERR_NOT_INITIALIZED;
  5237. }
  5238. /** Stops/Resumes receiving all remote users' video streams by default.
  5239. @param mute Sets whether to receive/stop receiving all remote users' video streams by default:
  5240. - true: Stop receiving all remote users' video streams by default.
  5241. - false: (Default) Receive all remote users' video streams by default.
  5242. @return
  5243. - 0: Success.
  5244. - < 0: Failure.
  5245. */
  5246. int setDefaultMuteAllRemoteVideoStreams(bool mute) {
  5247. return m_parameter ? m_parameter->setBool("rtc.video.set_default_mute_peers", mute) : -ERR_NOT_INITIALIZED;
  5248. }
  5249. /** Stops/Resumes receiving a specified remote user's video stream.
  5250. @note If you called the \ref agora::rtc::IRtcEngine::muteAllRemoteVideoStreams "muteAllRemoteVideoStreams" method and set @p mute as @p true to stop receiving all remote video streams, call the *muteAllRemoteVideoStreams* method and set @p mute as @p false before calling this method.
  5251. @param uid User ID of the specified remote user.
  5252. @param mute Sets whether to receive/stop receiving the specified remote user's video stream:
  5253. - true: Stop receiving the specified remote user's video stream.
  5254. - false: (Default) Receive the specified remote user's video stream.
  5255. @return
  5256. - 0: Success.
  5257. - < 0: Failure.
  5258. */
  5259. int muteRemoteVideoStream(uid_t uid, bool mute) {
  5260. return setObject("rtc.video.mute_peer", "{\"uid\":%u,\"mute\":%s}", uid, mute ? "true" : "false");
  5261. }
  5262. /** **DEPRECATED** Use \ref agora::rtc::IAudioDeviceManager::setPlaybackDeviceVolume "setPlaybackDeviceVolume" instead. Sets the playback device volume.
  5263. @param volume Sets the volume of the playback device. The value ranges between 0 and 255.
  5264. @return
  5265. - 0: Success.
  5266. - < 0: Failure.
  5267. */
  5268. int setPlaybackDeviceVolume(int volume) {// [0,255]
  5269. return m_parameter ? m_parameter->setInt("che.audio.output.volume", volume) : -ERR_NOT_INITIALIZED;
  5270. }
  5271. /** Starts an audio recording.
  5272. The SDK allows recording during a call. Supported formats:
  5273. - .wav: Large file size with high fidelity.
  5274. - .aac: Small file size with low fidelity.
  5275. Ensure that the directory to save the recording file exists and is writable.
  5276. This method is usually called after the \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method.
  5277. The recording automatically stops when the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method is called.
  5278. @param filePath Pointer to the absolute file path of the recording file. The string of the file name is in UTF-8.
  5279. @param quality Sets the audio recording quality. See #AUDIO_RECORDING_QUALITY_TYPE.
  5280. @return
  5281. - 0: Success.
  5282. - < 0: Failure.
  5283. */
  5284. int startAudioRecording(const char* filePath, AUDIO_RECORDING_QUALITY_TYPE quality) {
  5285. if (!m_parameter) return -ERR_NOT_INITIALIZED;
  5286. #if defined(_WIN32)
  5287. util::AString path;
  5288. if (!m_parameter->convertPath(filePath, path))
  5289. filePath = path->c_str();
  5290. else
  5291. return -ERR_INVALID_ARGUMENT;
  5292. #endif
  5293. return setObject("che.audio.start_recording", "{\"filePath\":\"%s\",\"quality\":%d}", filePath, quality);
  5294. }
  5295. /** Stops an audio recording on the client.
  5296. You can call this method before calling the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method else, the recording automatically stops when the \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" method is called.
  5297. @return
  5298. - 0: Success
  5299. - < 0: Failure.
  5300. */
  5301. int stopAudioRecording() {
  5302. return m_parameter ? m_parameter->setBool("che.audio.stop_recording", true) : -ERR_NOT_INITIALIZED;
  5303. }
  5304. /** Starts playing and mixing the music file.
  5305. This method mixes the specified local audio file with the audio stream from the microphone, or replaces the microphone's audio stream with the specified local audio file. You can choose whether the other user can hear the local audio playback and specify the number of playback loops. This method also supports online music playback.
  5306. When the audio mixing file playback finishes after calling this method, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onAudioMixingFinished "onAudioMixingFinished" callback.
  5307. @note
  5308. - Call this method when you are in a channel.
  5309. - If the local audio mixing file does not exist, or if the SDK does not support the file format or cannot access the music file URL, the SDK returns WARN_AUDIO_MIXING_OPEN_ERROR = 701.
  5310. @param filePath Pointer to the absolute path of the local or online audio file to mix. Supported audio formats: 3GP, ASF, ADTS, AVI, MP3, MPEG-4, SAMI, and WAVE. For more information, see [Supported Media Formats in Media Foundation](https://docs.microsoft.com/en-us/windows/desktop/medfound/supported-media-formats-in-media-foundation).
  5311. @param loopback Sets which user can hear the audio mixing:
  5312. - true: Only the local user can hear the audio mixing.
  5313. - false: Both users can hear the audio mixing.
  5314. @param replace Sets the audio mixing content:
  5315. - true: Only the specified audio file is published; the audio stream received by the microphone is not published.
  5316. - false: The local audio file is mixed with the audio stream from the microphone.
  5317. @param cycle Sets the number of playback loops:
  5318. - Positive integer: Number of playback loops.
  5319. - -1: Infinite playback loops.
  5320. @return
  5321. - 0: Success.
  5322. - < 0: Failure.
  5323. */
  5324. int startAudioMixing(const char* filePath, bool loopback, bool replace, int cycle) {
  5325. if (!m_parameter) return -ERR_NOT_INITIALIZED;
  5326. #if defined(_WIN32)
  5327. util::AString path;
  5328. if (!m_parameter->convertPath(filePath, path))
  5329. filePath = path->c_str();
  5330. else
  5331. return -ERR_INVALID_ARGUMENT;
  5332. #endif
  5333. return setObject("che.audio.start_file_as_playout", "{\"filePath\":\"%s\",\"loopback\":%s,\"replace\":%s,\"cycle\":%d}",
  5334. filePath,
  5335. loopback?"true":"false",
  5336. replace?"true":"false",
  5337. cycle);
  5338. }
  5339. /** Stops playing and mixing the music file.
  5340. Call this method when you are in a channel.
  5341. @return
  5342. - 0: Success.
  5343. - < 0: Failure.
  5344. */
  5345. int stopAudioMixing() {
  5346. return m_parameter ? m_parameter->setBool("che.audio.stop_file_as_playout", true) : -ERR_NOT_INITIALIZED;
  5347. }
  5348. /** Pauses playing and mixing the music file.
  5349. Call this method when you are in a channel.
  5350. @return
  5351. - 0: Success.
  5352. - < 0: Failure.
  5353. */
  5354. int pauseAudioMixing() {
  5355. return m_parameter ? m_parameter->setBool("che.audio.pause_file_as_playout", true) : -ERR_NOT_INITIALIZED;
  5356. }
  5357. /** Resumes playing and mixing the music file.
  5358. Call this method when you are in a channel.
  5359. @return
  5360. - 0: Success.
  5361. - < 0: Failure.
  5362. */
  5363. int resumeAudioMixing() {
  5364. return m_parameter ? m_parameter->setBool("che.audio.pause_file_as_playout", false) : -ERR_NOT_INITIALIZED;
  5365. }
  5366. /** Adjusts the volume during audio mixing.
  5367. Call this method when you are in a channel.
  5368. @param volume Audio mixing volume. The value ranges between 0 and 100 (default).
  5369. @return
  5370. - 0: Success.
  5371. - < 0: Failure.
  5372. */
  5373. int adjustAudioMixingVolume(int volume) {
  5374. int ret = adjustAudioMixingPlayoutVolume(volume);
  5375. if (ret == 0) {
  5376. adjustAudioMixingPublishVolume(volume);
  5377. }
  5378. return ret;
  5379. }
  5380. /** Adjusts the audio mixing volume for local playback.
  5381. @note Call this method when you are in a channel.
  5382. @param volume Audio mixing volume for local playback. The value ranges between 0 and 100 (default).
  5383. @return
  5384. - 0: Success.
  5385. - < 0: Failure.
  5386. */
  5387. int adjustAudioMixingPlayoutVolume(int volume) {
  5388. return m_parameter ? m_parameter->setInt("che.audio.set_file_as_playout_volume", volume) : -ERR_NOT_INITIALIZED;
  5389. }
  5390. /** Retrieves the audio mixing volume for local playback.
  5391. This method helps troubleshoot audio volume related issues.
  5392. @note Call this method when you are in a channel.
  5393. @return
  5394. - &ge; 0: The audio mixing volume, if this method call succeeds. The value range is [0,100].
  5395. - < 0: Failure.
  5396. */
  5397. int getAudioMixingPlayoutVolume() {
  5398. int volume = 0;
  5399. int r = m_parameter ? m_parameter->getInt("che.audio.get_file_as_playout_volume", volume) : -ERR_NOT_INITIALIZED;
  5400. if (r == 0)
  5401. r = volume;
  5402. return r;
  5403. }
  5404. /** Adjusts the audio mixing volume for publishing (for remote users).
  5405. @note Call this method when you are in a channel.
  5406. @param volume Audio mixing volume for publishing. The value ranges between 0 and 100 (default).
  5407. @return
  5408. - 0: Success.
  5409. - < 0: Failure.
  5410. */
  5411. int adjustAudioMixingPublishVolume(int volume) {
  5412. return m_parameter ? m_parameter->setInt("che.audio.set_file_as_playout_publish_volume", volume) : -ERR_NOT_INITIALIZED;
  5413. }
  5414. /** Retrieves the audio mixing volume for publishing.
  5415. This method helps troubleshoot audio volume related issues.
  5416. @note Call this method when you are in a channel.
  5417. @return
  5418. - &ge; 0: The audio mixing volume for publishing, if this method call succeeds. The value range is [0,100].
  5419. - < 0: Failure.
  5420. */
  5421. int getAudioMixingPublishVolume() {
  5422. int volume = 0;
  5423. int r = m_parameter ? m_parameter->getInt("che.audio.get_file_as_playout_publish_volume", volume) : -ERR_NOT_INITIALIZED;
  5424. if (r == 0)
  5425. r = volume;
  5426. return r;
  5427. }
  5428. /** Retrieves the duration (ms) of the music file.
  5429. Call this method when you are in a channel.
  5430. @return
  5431. - &ge; 0: The audio mixing duration, if this method call succeeds.
  5432. - < 0: Failure.
  5433. */
  5434. int getAudioMixingDuration() {
  5435. int duration = 0;
  5436. int r = m_parameter ? m_parameter->getInt("che.audio.get_mixing_file_length_ms", duration) : -ERR_NOT_INITIALIZED;
  5437. if (r == 0)
  5438. r = duration;
  5439. return r;
  5440. }
  5441. /** Retrieves the playback position (ms) of the music file.
  5442. Call this method when you are in a channel.
  5443. @return
  5444. - &ge; 0: The current playback position of the audio mixing, if this method call succeeds.
  5445. - < 0: Failure.
  5446. */
  5447. int getAudioMixingCurrentPosition() {
  5448. if (!m_parameter) return -ERR_NOT_INITIALIZED;
  5449. int pos = 0;
  5450. int r = m_parameter->getInt("che.audio.get_mixing_file_played_ms", pos);
  5451. if (r == 0)
  5452. r = pos;
  5453. return r;
  5454. }
  5455. /** Sets the playback position of the music file to a different starting position (the default plays from the beginning).
  5456. @param pos The playback starting position (ms) of the music file.
  5457. @return
  5458. - 0: Success.
  5459. - < 0: Failure.
  5460. */
  5461. int setAudioMixingPosition(int pos /*in ms*/) {
  5462. return m_parameter ? m_parameter->setInt("che.audio.mixing.file.position", pos) : -ERR_NOT_INITIALIZED;
  5463. }
  5464. /** Retrieves the volume of the audio effects.
  5465. The value ranges between 0.0 and 100.0.
  5466. @return
  5467. - &ge; 0: Volume of the audio effects, if this method call succeeds.
  5468. - < 0: Failure.
  5469. */
  5470. int getEffectsVolume() {
  5471. if (!m_parameter) return -ERR_NOT_INITIALIZED;
  5472. int volume = 0;
  5473. int r = m_parameter->getInt("che.audio.game_get_effects_volume", volume);
  5474. if (r == 0)
  5475. r = volume;
  5476. return r;
  5477. }
  5478. /** Sets the volume of the audio effects.
  5479. @param volume Sets the volume of the audio effects. The value ranges between 0 and 100 (default).
  5480. @return
  5481. - 0: Success.
  5482. - < 0: Failure.
  5483. */
  5484. int setEffectsVolume(int volume) {
  5485. return m_parameter ? m_parameter->setInt("che.audio.game_set_effects_volume", volume) : -ERR_NOT_INITIALIZED;
  5486. }
  5487. /** Sets the volume of a specified audio effect.
  5488. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  5489. @param volume Sets the volume of the specified audio effect. The value ranges between 0.0 and 100.0 (default).
  5490. @return
  5491. - 0: Success.
  5492. - < 0: Failure.
  5493. */
  5494. int setVolumeOfEffect(int soundId, int volume) {
  5495. return setObject(
  5496. "che.audio.game_adjust_effect_volume",
  5497. "{\"soundId\":%d,\"gain\":%d}",
  5498. soundId, volume);
  5499. }
  5500. /** Plays a specified local or online audio effect file.
  5501. This method allows you to set the loop count, pitch, pan, and gain of the audio effect file, as well as whether the remote user can hear the audio effect.
  5502. To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time.
  5503. When the audio effect file playback finishes, the SDK returns the \ref IRtcEngineEventHandler::onAudioEffectFinished "onAudioEffectFinished" callback.
  5504. @param soundId ID of the specified audio effect. Each audio effect has a unique ID.
  5505. @note
  5506. - If the audio effect is preloaded into the memory through the \ref IRtcEngine::preloadEffect "preloadEffect" method, the value of @p soundID must be the same as that in the *preloadEffect* method.
  5507. - Playing multiple online audio effect files simultaneously is not supported on macOS and Windows.
  5508. @param filePath The absolute path to the local audio effect file or the URL of the online audio effect file.
  5509. @param loopCount Sets the number of times the audio effect loops:
  5510. - 0: Play the audio effect once.
  5511. - 1: Play the audio effect twice.
  5512. - -1: Play the audio effect in an indefinite loop until the \ref IRtcEngine::stopEffect "stopEffect" or \ref IRtcEngine::stopAllEffects "stopAllEffects" method is called.
  5513. @param pitch Sets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch.
  5514. @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0:
  5515. - 0.0: The audio effect displays ahead.
  5516. - 1.0: The audio effect displays to the right.
  5517. - -1.0: The audio effect displays to the left.
  5518. @param gain Sets the volume of the audio effect. The value ranges between 0.0 and 100.0 (default). The lower the value, the lower the volume of the audio effect.
  5519. @param publish Sets whether or not to publish the specified audio effect to the remote stream:
  5520. - true: The locally played audio effect is published to the Agora Cloud and the remote users can hear it.
  5521. - false: The locally played audio effect is not published to the Agora Cloud and the remote users cannot hear it.
  5522. @return
  5523. - 0: Success.
  5524. - < 0: Failure.
  5525. */
  5526. int playEffect(int soundId, const char* filePath, int loopCount, double pitch, double pan, int gain, bool publish = false) {
  5527. #if defined(_WIN32)
  5528. util::AString path;
  5529. if (!m_parameter->convertPath(filePath, path))
  5530. filePath = path->c_str();
  5531. else if (!filePath)
  5532. filePath = "";
  5533. #endif
  5534. return setObject(
  5535. "che.audio.game_play_effect",
  5536. "{\"soundId\":%d,\"filePath\":\"%s\",\"loopCount\":%d, \"pitch\":%lf,\"pan\":%lf,\"gain\":%d, \"send2far\":%d}",
  5537. soundId, filePath, loopCount, pitch, pan, gain, publish);
  5538. }
  5539. /** Stops playing a specified audio effect.
  5540. @param soundId ID of the audio effect to stop playing. Each audio effect has a unique ID.
  5541. @return
  5542. - 0: Success.
  5543. - < 0: Failure.
  5544. */
  5545. int stopEffect(int soundId) {
  5546. return m_parameter ? m_parameter->setInt(
  5547. "che.audio.game_stop_effect", soundId) : -ERR_NOT_INITIALIZED;
  5548. }
  5549. /** Stops playing all audio effects.
  5550. @return
  5551. - 0: Success.
  5552. - < 0: Failure.
  5553. */
  5554. int stopAllEffects() {
  5555. return m_parameter ? m_parameter->setBool(
  5556. "che.audio.game_stop_all_effects", true) : -ERR_NOT_INITIALIZED;
  5557. }
  5558. /** Preloads a specified audio effect file into the memory.
  5559. @note This method does not support online audio effect files.
  5560. To ensure smooth communication, limit the size of the audio effect file. We recommend using this method to preload the audio effect before calling the \ref IRtcEngine::joinChannel "joinChannel" method.
  5561. Supported audio formats: mp3, aac, m4a, 3gp, and wav.
  5562. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  5563. @param filePath Pointer to the absolute path of the audio effect file.
  5564. @return
  5565. - 0: Success.
  5566. - < 0: Failure.
  5567. */
  5568. int preloadEffect(int soundId, char* filePath) {
  5569. return setObject(
  5570. "che.audio.game_preload_effect",
  5571. "{\"soundId\":%d,\"filePath\":\"%s\"}",
  5572. soundId, filePath);
  5573. }
  5574. /** Releases a specified preloaded audio effect from the memory.
  5575. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  5576. @return
  5577. - 0: Success.
  5578. - < 0: Failure.
  5579. */
  5580. int unloadEffect(int soundId) {
  5581. return m_parameter ? m_parameter->setInt(
  5582. "che.audio.game_unload_effect", soundId) : -ERR_NOT_INITIALIZED;
  5583. }
  5584. /** Pauses a specified audio effect.
  5585. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  5586. @return
  5587. - 0: Success.
  5588. - < 0: Failure.
  5589. */
  5590. int pauseEffect(int soundId) {
  5591. return m_parameter ? m_parameter->setInt(
  5592. "che.audio.game_pause_effect", soundId) : -ERR_NOT_INITIALIZED;
  5593. }
  5594. /** Pauses all audio effects.
  5595. @return
  5596. - 0: Success.
  5597. - < 0: Failure.
  5598. */
  5599. int pauseAllEffects() {
  5600. return m_parameter ? m_parameter->setBool(
  5601. "che.audio.game_pause_all_effects", true) : -ERR_NOT_INITIALIZED;
  5602. }
  5603. /** Resumes playing a specified audio effect.
  5604. @param soundId ID of the audio effect. Each audio effect has a unique ID.
  5605. @return
  5606. - 0: Success.
  5607. - < 0: Failure.
  5608. */
  5609. int resumeEffect(int soundId) {
  5610. return m_parameter ? m_parameter->setInt(
  5611. "che.audio.game_resume_effect", soundId) : -ERR_NOT_INITIALIZED;
  5612. }
  5613. /** Resumes playing all audio effects.
  5614. @return
  5615. - 0: Success.
  5616. - < 0: Failure.
  5617. */
  5618. int resumeAllEffects() {
  5619. return m_parameter ? m_parameter->setBool(
  5620. "che.audio.game_resume_all_effects", true) : -ERR_NOT_INITIALIZED;
  5621. }
  5622. /** Enables/Disables stereo panning for remote users.
  5623. Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling \ref agora::rtc::IRtcEngine::setRemoteVoicePosition "setRemoteVoicePosition".
  5624. @param enabled Sets whether or not to enable stereo panning for remote users:
  5625. - true: enables stereo panning.
  5626. - false: disables stereo panning.
  5627. @return
  5628. - 0: Success.
  5629. - < 0: Failure.
  5630. */
  5631. int enableSoundPositionIndication(bool enabled) {
  5632. return m_parameter ? m_parameter->setBool(
  5633. "che.audio.enable_sound_position", enabled) : -ERR_NOT_INITIALIZED;
  5634. }
  5635. /** Sets the sound position and gain of a remote user.
  5636. When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.
  5637. @note
  5638. - For this method to work, enable stereo panning for remote users by calling enableSoundPositionIndication before joining a channel.
  5639. - This method requires hardware support. For the best sound positioning, we recommend using a stereo speaker.
  5640. @param uid The ID of the remote user.
  5641. @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0:
  5642. - 0.0: the remote sound comes from the front.
  5643. - -1.0: the remote sound comes from the left.
  5644. - 1.0: the remote sound comes from the right.
  5645. @param gain Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain.
  5646. @return
  5647. - 0: Success.
  5648. - < 0: Failure.
  5649. */
  5650. int setRemoteVoicePosition(int uid, double pan, double gain) {
  5651. return setObject("che.audio.game_place_sound_position", "{\"uid\":%d,\"pan\":%lf,\"gain\":%lf}", uid, pan, gain);
  5652. }
  5653. /** Changes the voice pitch of the local speaker.
  5654. @param pitch Sets the voice pitch. The value ranges between 0.5 and 2.0. The lower the value, the lower the voice pitch. The default value is 1.0 (no change to the local voice pitch).
  5655. @return
  5656. - 0: Success.
  5657. - < 0: Failure.
  5658. */
  5659. int setLocalVoicePitch(double pitch) {
  5660. return m_parameter ? m_parameter->setInt(
  5661. "che.audio.morph.pitch_shift",
  5662. static_cast<int>(pitch * 100)) : -ERR_NOT_INITIALIZED;
  5663. }
  5664. /** Sets the local voice equalization effect.
  5665. @param bandFrequency Sets the band frequency. The value ranges between 0 and 9, representing the respective 10-band center frequencies of the voice effects, including 31, 62, 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. See #AUDIO_EQUALIZATION_BAND_FREQUENCY.
  5666. @param bandGain Sets the gain of each band in dB. The value ranges between -15 and 15.
  5667. @return
  5668. - 0: Success.
  5669. - < 0: Failure.
  5670. */
  5671. int setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) {
  5672. return setObject(
  5673. "che.audio.morph.equalization",
  5674. "{\"index\":%d,\"gain\":%d}",
  5675. static_cast<int>(bandFrequency), bandGain);
  5676. }
  5677. /** Sets the local voice reverberation.
  5678. v2.4.0 adds the \ref agora::rtc::IRtcEngine::setLocalVoiceReverbPreset "setLocalVoiceReverbPreset" method, a more user-friendly method for setting the local voice reverberation. You can use this method to set the local reverberation effect, such as pop music, R&B, rock music, and hip-hop.
  5679. @param reverbKey Sets the reverberation key. See #AUDIO_REVERB_TYPE.
  5680. @param value Sets the value of the reverberation key.
  5681. @return
  5682. - 0: Success.
  5683. - < 0: Failure.
  5684. */
  5685. int setLocalVoiceReverb(AUDIO_REVERB_TYPE reverbKey, int value) {
  5686. return setObject(
  5687. "che.audio.morph.reverb",
  5688. "{\"key\":%d,\"value\":%d}",
  5689. static_cast<int>(reverbKey), value);
  5690. }
  5691. /** Sets the local voice changer option.
  5692. @note Do not use this method together with the \ref agora::rtc::IRtcEngine::setLocalVoiceReverbPreset "setLocalVoiceReverbPreset" method, because the method called later overrides the one called earlier.
  5693. @param voiceChanger Sets the local voice changer option. See #VOICE_CHANGER_PRESET.
  5694. @return
  5695. - 0: Success.
  5696. - < 0: Failure.
  5697. */
  5698. int setLocalVoiceChanger(VOICE_CHANGER_PRESET voiceChanger) {
  5699. return m_parameter ? m_parameter->setInt("che.audio.morph.voice_changer", static_cast<int>(voiceChanger)) : -ERR_NOT_INITIALIZED;
  5700. }
  5701. /** Sets the preset local voice reverberation effect.
  5702. @note
  5703. - Do not use this method together with \ref agora::rtc::IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb".
  5704. - Do not use this method together with the \ref agora::rtc::IRtcEngine::setLocalVoiceChanger "setLocalVoiceChanger" method, because the method called later overrides the one called earlier.
  5705. @param reverbPreset Sets the preset audio reverberation configuration. See #AUDIO_REVERB_PRESET.
  5706. @return
  5707. - 0: Success.
  5708. - < 0: Failure.
  5709. */
  5710. int setLocalVoiceReverbPreset(AUDIO_REVERB_PRESET reverbPreset) {
  5711. return m_parameter ? m_parameter->setInt("che.audio.morph.reverb_preset", static_cast<int>(reverbPreset)) : -ERR_NOT_INITIALIZED;
  5712. }
  5713. /** **DEPRECATED** Use \ref IRtcEngine::disableAudio "disableAudio" instead. Disables the audio function in the channel.
  5714. @return
  5715. - 0: Success.
  5716. - < 0: Failure.
  5717. */
  5718. int pauseAudio() {
  5719. return m_parameter ? m_parameter->setBool("che.pause.audio", true) : -ERR_NOT_INITIALIZED;
  5720. }
  5721. /** **DEPRECATED** Use the \ref IRtcEngine::enableAudio "enableAudio" method instead.
  5722. Resumes playing the audio in the channel.
  5723. @return
  5724. - 0: Success.
  5725. - < 0: Failure.
  5726. */
  5727. int resumeAudio() {
  5728. return m_parameter ? m_parameter->setBool("che.pause.audio", false) : -ERR_NOT_INITIALIZED;
  5729. }
  5730. /** **DEPRECATED** Agora does not recommend using this method.
  5731. Sets the high-quality audio preferences. Call this method and set all parameters before joining a channel.
  5732. Do not call this method again after joining a channel.
  5733. @param fullband Sets whether to enable/disable full-band codec (48-kHz sample rate). Not compatible with SDK versions before v1.7.4:
  5734. - true: Enable full-band codec.
  5735. - false: Disable full-band codec.
  5736. @param stereo Sets whether to enable/disable stereo codec. Not compatible with SDK versions before v1.7.4:
  5737. - true: Enable stereo codec.
  5738. - false: Disable stereo codec.
  5739. @param fullBitrate Sets whether to enable/disable high-bitrate mode. Recommended in voice-only mode:
  5740. - true: Enable high-bitrate mode.
  5741. - false: Disable high-bitrate mode.
  5742. @return
  5743. - 0: Success.
  5744. - < 0: Failure.
  5745. */
  5746. int setHighQualityAudioParameters(bool fullband, bool stereo, bool fullBitrate) {
  5747. return setObject("che.audio.codec.hq", "{\"fullband\":%s,\"stereo\":%s,\"fullBitrate\":%s}", fullband ? "true" : "false", stereo ? "true" : "false", fullBitrate ? "true" : "false");
  5748. }
  5749. /** Adjusts the recording volume.
  5750. @param volume Recording volume. The value ranges between 0 and 400:
  5751. - 0: Mute.
  5752. - 100: Original volume.
  5753. - 400: (Maximum) Four times the original volume with signal clipping protection.
  5754. @return
  5755. - 0: Success.
  5756. - < 0: Failure.
  5757. */
  5758. int adjustRecordingSignalVolume(int volume) {//[0, 400]: e.g. 50~0.5x 100~1x 400~4x
  5759. if (volume < 0)
  5760. volume = 0;
  5761. else if (volume > 400)
  5762. volume = 400;
  5763. return m_parameter ? m_parameter->setInt("che.audio.record.signal.volume", volume) : -ERR_NOT_INITIALIZED;
  5764. }
  5765. /** Adjusts the playback volume.
  5766. @param volume Playback volume. The value ranges between 0 and 400:
  5767. - 0: Mute.
  5768. - 100: Original volume.
  5769. - 400: (Maximum) Four times the original volume with signal clipping protection.
  5770. @return
  5771. - 0: Success.
  5772. - < 0: Failure.
  5773. */
  5774. int adjustPlaybackSignalVolume(int volume) {//[0, 400]
  5775. if (volume < 0)
  5776. volume = 0;
  5777. else if (volume > 400)
  5778. volume = 400;
  5779. return m_parameter ? m_parameter->setInt("che.audio.playout.signal.volume", volume) : -ERR_NOT_INITIALIZED;
  5780. }
  5781. /** Enables the \ref agora::rtc::IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" callback at a set time interval to report on which users are speaking and the speakers' volume.
  5782. Once this method is enabled, the SDK returns the volume indication in the \ref agora::rtc::IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" callback at the set time interval, whether or not any user is speaking in the channel.
  5783. @param interval Sets the time interval between two consecutive volume indications:
  5784. - &le; 0: Disables the volume indication.
  5785. - > 0: Time interval (ms) between two consecutive volume indications. We recommend setting @p interval &gt; 200 ms. Do not set @p interval &lt; 10 ms, or the *onAudioVolumeIndication* callback will not be triggered.
  5786. @param smooth Smoothing factor sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The greater the value, the more sensitive the indicator. The recommended value is 3.
  5787. @return
  5788. - 0: Success.
  5789. - < 0: Failure.
  5790. */
  5791. int enableAudioVolumeIndication(int interval, int smooth) { // in ms: <= 0: disable, > 0: enable, interval in ms
  5792. if (interval < 0)
  5793. interval = 0;
  5794. return setObject("che.audio.volume_indication", "{\"interval\":%d,\"smooth\":%d}", interval, smooth);
  5795. }
  5796. /** Stops/Resumes sending the local audio stream.
  5797. @note When @p mute is set as @p true, this method does not disable the microphone, which does not affect any ongoing recording.
  5798. @param mute Sets whether to send/stop sending the local audio stream:
  5799. - true: Stops sending the local audio stream.
  5800. - false: (Default) Sends the local audio stream.
  5801. @return
  5802. - 0: Success.
  5803. - < 0: Failure.
  5804. */
  5805. int muteLocalAudioStream(bool mute) {
  5806. return setParameters("{\"rtc.audio.mute_me\":%s,\"che.audio.mute_me\":%s}", mute ? "true" : "false", mute ? "true" : "false");
  5807. }
  5808. // mute/unmute all peers. unmute will clear all muted peers specified mutePeer() interface
  5809. /** Stops/Resumes receiving a specified remote user's audio stream.
  5810. @note If you called the \ref agora::rtc::IRtcEngine::muteAllRemoteAudioStreams "muteAllRemoteAudioStreams" method and set @p mute as @p true to stop receiving all remote users' audio streams, call the *muteAllRemoteAudioStreams* method and set @p mute as @p false before calling this method. The *muteAllRemoteAudioStreams* method sets all remote audio streams, while the *muteRemoteAudioStream* method sets a specified remote audio stream.
  5811. @param uid User ID of the specified remote user sending the audio.
  5812. @param mute Sets whether to receive/stop receiving a specified remote user's audio stream:
  5813. - true: Stops receiving the specified remote user's audio stream.
  5814. - false: (Default) Receives the specified remote user's audio stream.
  5815. @return
  5816. - 0: Success.
  5817. - < 0: Failure.
  5818. */
  5819. int muteRemoteAudioStream(uid_t uid, bool mute) {
  5820. return setObject("rtc.audio.mute_peer", "{\"uid\":%u,\"mute\":%s}", uid, mute?"true":"false");
  5821. }
  5822. /** Stops/Resumes receiving all remote users' audio streams.
  5823. @param mute Sets whether to receive/stop receiving all remote users' audio streams.
  5824. - true: Stops receiving all remote users' audio streams.
  5825. - false: (Default) Receives all remote users' audio streams.
  5826. @return
  5827. - 0: Success.
  5828. - < 0: Failure.
  5829. */
  5830. int muteAllRemoteAudioStreams(bool mute) {
  5831. return m_parameter ? m_parameter->setBool("rtc.audio.mute_peers", mute) : -ERR_NOT_INITIALIZED;
  5832. }
  5833. /** Stops/Resumes receiving all remote users' audio streams by default.
  5834. @param mute Sets whether to receive/stop receiving all remote users' audio streams by default:
  5835. - true: Stops receiving all remote users' audio streams by default.
  5836. - false: (Default) Receives all remote users' audio streams by default.
  5837. @return
  5838. - 0: Success.
  5839. - < 0: Failure.
  5840. */
  5841. int setDefaultMuteAllRemoteAudioStreams(bool mute) {
  5842. return m_parameter ? m_parameter->setBool("rtc.audio.set_default_mute_peers", mute) : -ERR_NOT_INITIALIZED;
  5843. }
  5844. /** Sets the external audio source.
  5845. @param enabled Sets whether to enable/disable the external audio source:
  5846. - true: Enables the external audio source.
  5847. - false: (Default) Disables the external audio source.
  5848. @param sampleRate Sets the sample rate of the external audio source, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  5849. @param channels Sets the audio channels of the external audio source (two channels maximum).
  5850. @return
  5851. - 0: Success.
  5852. - < 0: Failure.
  5853. */
  5854. int setExternalAudioSource(bool enabled, int sampleRate, int channels) {
  5855. if (enabled)
  5856. return setParameters("{\"che.audio.external_capture\":true,\"che.audio.external_capture.push\":true,\"che.audio.set_capture_raw_audio_format\":{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d}}", sampleRate, channels, RAW_AUDIO_FRAME_OP_MODE_TYPE::RAW_AUDIO_FRAME_OP_MODE_READ_WRITE);
  5857. else
  5858. return setParameters("{\"che.audio.external_capture\":false,\"che.audio.external_capture.push\":false}");
  5859. }
  5860. /** Sets the external audio sink.
  5861. If you enable the external audio sink, you can pull the audio frame by periodically calling the \ref agora::media::IMediaEngine::pullAudioFrame "pullAudioFrame" method.
  5862. @param enabled
  5863. - true: Enables the external audio sink.
  5864. - false: Disables the external audio sink.
  5865. @param sampleRate Sets the sample rate of the external audio sink, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  5866. @param channels Sets the audio channels of the external audio sink (two channels maximum).
  5867. @note Enabling the external audio sink disables the "Raw Audio Data" method, and the application will not retrieve the audio frame from the \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame "onPlaybackAudioFrame" callback.
  5868. @return
  5869. - 0: Success.
  5870. - < 0: Failure.
  5871. */
  5872. int setExternalAudioSink(bool enabled, int sampleRate, int channels) {
  5873. if (enabled)
  5874. return setParameters("{\"che.audio.external_render\":true,\"che.audio.external_render.pull\":true,\"che.audio.set_render_raw_audio_format\":{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d}}", sampleRate, channels, RAW_AUDIO_FRAME_OP_MODE_TYPE::RAW_AUDIO_FRAME_OP_MODE_READ_ONLY);
  5875. else
  5876. return setParameters("{\"che.audio.external_render\":false,\"che.audio.external_render.pull\":false}");
  5877. }
  5878. /** Specifies an SDK output log file.
  5879. The log file records all SDK operations during runtime. If it does not exist, the SDK creates one.
  5880. @note
  5881. - The default log file is located at: C:\Users\<user_name>\AppData\Local\Agora\<process_name>.
  5882. - Ensure that you call this method immediately after calling the \ref agora::rtc::IRtcEngine::initialize "initialize" method, otherwise the output log may not be complete.
  5883. @param filePath File path of the log file. The string of the log file is in UTF-8.
  5884. @return
  5885. - 0: Success.
  5886. - < 0: Failure.
  5887. */
  5888. int setLogFile(const char* filePath) {
  5889. if (!m_parameter) return -ERR_NOT_INITIALIZED;
  5890. #if defined(_WIN32)
  5891. util::AString path;
  5892. if (!m_parameter->convertPath(filePath, path))
  5893. filePath = path->c_str();
  5894. else if (!filePath)
  5895. filePath = "";
  5896. #endif
  5897. return m_parameter->setString("rtc.log_file", filePath);
  5898. }
  5899. /** Sets the output log level of the SDK.
  5900. You can use one or a combination of the log filter levels. The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG. Choose a level to see the logs preceding that level.
  5901. If you set the log level to WARNING, you see the logs within levels CRITICAL, ERROR, and WARNING.
  5902. @param filter Sets the log filter level. See #LOG_FILTER_TYPE.
  5903. @return
  5904. - 0: Success.
  5905. - < 0: Failure.
  5906. */
  5907. int setLogFilter(unsigned int filter) {
  5908. return m_parameter ? m_parameter->setUInt("rtc.log_filter", filter&LOG_FILTER_MASK) : -ERR_NOT_INITIALIZED;
  5909. }
  5910. /** Sets the log file size (KB).
  5911. The SDK has two log files, each with a default size of 512 KB. If you set @p fileSizeInBytes as 1024 KB, the SDK outputs log files with a total maximum size of 2 MB. If the total size of the log files exceed the set value, the new output log files overwrite the old output log files.
  5912. @param fileSizeInKBytes The SDK log file size (KB).
  5913. @return
  5914. - 0: Success.
  5915. - <0: Failure.
  5916. */
  5917. int setLogFileSize(unsigned int fileSizeInKBytes) {
  5918. return m_parameter ? m_parameter->setUInt("rtc.log_size", fileSizeInKBytes) : -ERR_NOT_INITIALIZED;
  5919. }
  5920. /** Sets the local video display mode.
  5921. This method can be called multiple times during a call to change the display mode.
  5922. @param renderMode Sets the local video display mode. See #RENDER_MODE_TYPE.
  5923. @return
  5924. - 0: Success.
  5925. - < 0: Failure.
  5926. */
  5927. int setLocalRenderMode(RENDER_MODE_TYPE renderMode) {
  5928. return setRemoteRenderMode(0, renderMode);
  5929. }
  5930. /** Sets the video display mode of a specified remote user.
  5931. This method can be called multiple times during a call to change the display mode.
  5932. @param uid ID of the remote user.
  5933. @param renderMode Sets the video display mode. See #RENDER_MODE_TYPE.
  5934. @return
  5935. - 0: Success.
  5936. - < 0: Failure.
  5937. */
  5938. int setRemoteRenderMode(uid_t uid, RENDER_MODE_TYPE renderMode) {
  5939. return setObject("che.video.render_mode", "{\"uid\":%u,\"mode\":%d}", uid, renderMode);
  5940. }
  5941. /** Sets the camera capturer configuration.
  5942. For a video call or live broadcast, generally the SDK controls the camera output parameters. When the default camera capturer settings do not meet special requirements or cause performance problems, we recommend using this method to set the camera capturer configuration:
  5943. - If the resolution or frame rate of the captured raw video data are higher than those set by \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration", processing video frames requires extra CPU and RAM usage and degrades performance. We recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE = 1 to avoid such problems.
  5944. - If you do not need local video preview or are willing to sacrifice preview quality, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE = 1 to optimize CPU and RAM usage.
  5945. - If you want better quality for the local video preview, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PREVIEW = 2.
  5946. @note Call this method before enabling the local camera. That said, you can call this method before calling \ref agora::rtc::IRtcEngine::joinChannel "joinChannel", \ref agora::rtc::IRtcEngine::enableVideo "enableVideo", or \ref IRtcEngine::enableLocalVideo "enableLocalVideo", depending on which method you use to turn on your local camera.
  5947. @param config Sets the camera capturer configuration. See CameraCapturerConfiguration.
  5948. @return
  5949. - 0: Success.
  5950. - < 0: Failure.
  5951. */
  5952. int setCameraCapturerConfiguration(const CameraCapturerConfiguration& config) {
  5953. if (!m_parameter) return -ERR_NOT_INITIALIZED;
  5954. return m_parameter->setInt("che.video.camera_capture_mode", (int)config.preference);
  5955. }
  5956. /** Sets the stream mode to the single-stream (default) or dual-stream mode. (Live broadcast only.)
  5957. If the dual-stream mode is enabled, the receiver can choose to receive the high stream (high-resolution and high-bitrate video stream), or the low stream (low-resolution and low-bitrate video stream).
  5958. @param enabled Sets the stream mode:
  5959. - true: Dual-stream mode.
  5960. - false: (Default) Single-stream mode.
  5961. */
  5962. int enableDualStreamMode(bool enabled) {
  5963. return setParameters("{\"rtc.dual_stream_mode\":%s,\"che.video.enableLowBitRateStream\":%d}", enabled ? "true" : "false", enabled ? 1 : 0);
  5964. }
  5965. /** Sets the remote user's video stream type received by the local user when the remote user sends dual streams.
  5966. This method allows the application to adjust the corresponding video-stream type based on the size of the video window to reduce the bandwidth and resources.
  5967. - If the remote user enables the dual-stream mode by calling the \ref agora::rtc::IRtcEngine::enableDualStreamMode "enableDualStreamMode" method, the SDK receives the high-stream video by default.
  5968. - If the dual-stream mode is not enabled, the SDK receives the high-stream video by default.
  5969. The method result returns in the \ref agora::rtc::IRtcEngineEventHandler::onApiCallExecuted "onApiCallExecuted" callback. The Agora SDK receives the high-stream video by default to reduce the bandwidth. If needed, users may use this method to switch to the low-stream video.
  5970. By default, the aspect ratio of the low-stream video is the same as the high-stream video. Once the resolution of the high-stream video is set, the system automatically sets the resolution, frame rate, and bitrate of the low-stream video.
  5971. @param uid ID of the remote user sending the video stream.
  5972. @param streamType Sets the video-stream type. See #REMOTE_VIDEO_STREAM_TYPE.
  5973. @return
  5974. - 0: Success.
  5975. - < 0: Failure.
  5976. */
  5977. int setRemoteVideoStreamType(uid_t uid, REMOTE_VIDEO_STREAM_TYPE streamType) {
  5978. return setParameters("{\"rtc.video.set_remote_video_stream\":{\"uid\":%u,\"stream\":%d}, \"che.video.setstream\":{\"uid\":%u,\"stream\":%d}}", uid, streamType, uid, streamType);
  5979. // return setObject("rtc.video.set_remote_video_stream", "{\"uid\":%u,\"stream\":%d}", uid, streamType);
  5980. }
  5981. /** Sets the default video-stream type for the video received by the local user when the remote user sends dual streams.
  5982. - If the dual-stream mode is enabled by calling the \ref agora::rtc::IRtcEngine::enableDualStreamMode "enableDualStreamMode" method, the user receives the high-stream video by default. The @p setRemoteDefaultVideoStreamType method allows the application to adjust the corresponding video-stream type according to the size of the video window, reducing the bandwidth and resources.
  5983. - If the dual-stream mode is not enabled, the user receives the high-stream video by default.
  5984. The result after calling this method is returned in the \ref agora::rtc::IRtcEngineEventHandler::onApiCallExecuted "onApiCallExecuted" callback. The Agora SDK receives the high-stream video by default to reduce the bandwidth. If needed, users can switch to the low-stream video through this method.
  5985. @param streamType Sets the default video-stream type. See #REMOTE_VIDEO_STREAM_TYPE.
  5986. @return
  5987. - 0: Success.
  5988. - < 0: Failure.
  5989. */
  5990. int setRemoteDefaultVideoStreamType(REMOTE_VIDEO_STREAM_TYPE streamType) {
  5991. return m_parameter ? m_parameter->setInt("rtc.video.set_remote_default_video_stream_type", streamType) : -ERR_NOT_INITIALIZED;
  5992. }
  5993. /** Sets the audio recording format for the \ref agora::media::IAudioFrameObserver::onRecordAudioFrame "onRecordAudioFrame" callback.
  5994. @param sampleRate Sets the sample rate (@p samplesPerSec) returned in the *onRecordAudioFrame* callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  5995. @param channel Sets the number of audio channels (@p channels) returned in the *onRecordAudioFrame* callback:
  5996. - 1: Mono
  5997. - 2: Stereo
  5998. @param mode Sets the use mode (see #RAW_AUDIO_FRAME_OP_MODE_TYPE) of the *onRecordAudioFrame* callback.
  5999. @param samplesPerCall Sets the sample points (@p samples) returned in the *onRecordAudioFrame* callback. @p samplesPerCall is usually set as 1024 for stream pushing.
  6000. samplesPerCall = (int)(sampleRate &times; sampleInterval), where sampleInterval &ge; 0.01 in seconds.
  6001. @return
  6002. - 0: Success.
  6003. - < 0: Failure.
  6004. */
  6005. int setRecordingAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) {
  6006. return setObject("che.audio.set_capture_raw_audio_format", "{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d,\"samplesPerCall\":%d}", sampleRate, channel, mode, samplesPerCall);
  6007. }
  6008. /** Sets the audio playback format for the \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame "onPlaybackAudioFrame" callback.
  6009. @param sampleRate Sets the sample rate (@p samplesPerSec) returned in the *onPlaybackAudioFrame* callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  6010. @param channel Sets the number of channels (@p channels) returned in the *onPlaybackAudioFrame* callback:
  6011. - 1: Mono
  6012. - 2: Stereo
  6013. @param mode Sets the use mode (see #RAW_AUDIO_FRAME_OP_MODE_TYPE) of the *onPlaybackAudioFrame* callback.
  6014. @param samplesPerCall Sets the sample points (*samples*) returned in the *onPlaybackAudioFrame* callback. @p samplesPerCall is usually set as 1024 for stream pushing.
  6015. samplesPerCall = (int)(sampleRate &times; sampleInterval), where sampleInterval &ge; 0.01 in seconds.
  6016. @return
  6017. - 0: Success.
  6018. - < 0: Failure.
  6019. */
  6020. int setPlaybackAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) {
  6021. return setObject("che.audio.set_render_raw_audio_format", "{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d,\"samplesPerCall\":%d}", sampleRate, channel, mode, samplesPerCall);
  6022. }
  6023. /** Sets the mixed audio format for the \ref agora::media::IAudioFrameObserver::onMixedAudioFrame "onMixedAudioFrame" callback.
  6024. @param sampleRate Sets the sample rate (@p samplesPerSec) returned in the *onMixedAudioFrame* callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  6025. @param samplesPerCall Sets the sample points (@p samples) returned in the *onMixedAudioFrame* callback. @p samplesPerCall is usually set as 1024 for stream pushing.
  6026. samplesPerCall = (int)(sampleRate &times; sampleInterval), where sampleInterval &ge; 0.01 in seconds.
  6027. @return
  6028. - 0: Success.
  6029. - < 0: Failure.
  6030. */
  6031. int setMixedAudioFrameParameters(int sampleRate, int samplesPerCall) {
  6032. return setObject("che.audio.set_mixed_raw_audio_format", "{\"sampleRate\":%d,\"samplesPerCall\":%d}", sampleRate, samplesPerCall);
  6033. }
  6034. /** Enables interoperability with the Agora Web SDK.
  6035. @note This method applies only to the Live-broadcast profile. In the Communication profile, interoperability with the Agora Web SDK is enabled by default.
  6036. @param enabled Sets whether to enable/disable interoperability with the Agora Web SDK:
  6037. - true: Enable.
  6038. - false: (Default) Disable.
  6039. @return
  6040. - 0: Success.
  6041. - < 0: Failure.
  6042. */
  6043. int enableWebSdkInteroperability(bool enabled) {//enable interoperability with zero-plugin web sdk
  6044. return setParameters("{\"rtc.video.web_h264_interop_enable\":%s,\"che.video.web_h264_interop_enable\":%s}", enabled ? "true" : "false", enabled ? "true" : "false");
  6045. }
  6046. //only for live broadcast
  6047. /** **DEPRECATED** Sets the preferences for the high-quality video. (Live broadcast only).
  6048. This method is deprecated as of v2.4.0.
  6049. @param preferFrameRateOverImageQuality Sets the video quality preference:
  6050. - true: Frame rate over image quality.
  6051. - false: (Default) Image quality over frame rate.
  6052. @return
  6053. - 0: Success.
  6054. - < 0: Failure.
  6055. */
  6056. int setVideoQualityParameters(bool preferFrameRateOverImageQuality) {
  6057. return setParameters("{\"rtc.video.prefer_frame_rate\":%s,\"che.video.prefer_frame_rate\":%s}", preferFrameRateOverImageQuality ? "true" : "false", preferFrameRateOverImageQuality ? "true" : "false");
  6058. }
  6059. /** Sets the local video mirror mode.
  6060. You must call this method before calling the \ref agora::rtc::IRtcEngine::startPreview "startPreview" method, otherwise the mirror mode will not work.
  6061. @param mirrorMode Sets the local video mirror mode. See #VIDEO_MIRROR_MODE_TYPE.
  6062. @return
  6063. - 0: Success.
  6064. - < 0: Failure.
  6065. */
  6066. int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) {
  6067. if (!m_parameter) return -ERR_NOT_INITIALIZED;
  6068. const char *value;
  6069. switch (mirrorMode) {
  6070. case VIDEO_MIRROR_MODE_AUTO:
  6071. value = "default";
  6072. break;
  6073. case VIDEO_MIRROR_MODE_ENABLED:
  6074. value = "forceMirror";
  6075. break;
  6076. case VIDEO_MIRROR_MODE_DISABLED:
  6077. value = "disableMirror";
  6078. break;
  6079. default:
  6080. return -ERR_INVALID_ARGUMENT;
  6081. }
  6082. return m_parameter->setString("che.video.localViewMirrorSetting", value);
  6083. }
  6084. /** Sets the fallback option for the locally published video stream based on the network conditions.
  6085. The default setting for @p option is #STREAM_FALLBACK_OPTION_DISABLED, where there is no fallback behavior for the locally published video stream when the uplink network conditions are poor.
  6086. If *option* is set as #STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK will:
  6087. - Disable the upstream video but enable audio only when the network conditions worsen and cannot support both video and audio.
  6088. - Re-enable the video when the network conditions improve.
  6089. When the locally published video stream falls back to audio only or when the audio-only stream switches back to the video, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onLocalPublishFallbackToAudioOnly "onLocalPublishFallbackToAudioOnly" callback.
  6090. @note Agora does not recommend using this method for CDN live streaming, because the remote CDN live user will have a noticeable lag when the locally publish stream falls back to audio-only.
  6091. @param option Sets the fallback option for the locally published video stream. See #STREAM_FALLBACK_OPTIONS.
  6092. @return
  6093. - 0: Success.
  6094. - < 0: Failure.
  6095. */
  6096. int setLocalPublishFallbackOption(STREAM_FALLBACK_OPTIONS option) {
  6097. return m_parameter ? m_parameter->setInt("rtc.local_publish_fallback_option", option) : -ERR_NOT_INITIALIZED;
  6098. }
  6099. /** Sets the fallback option for the remotely subscribed video stream based on the network conditions.
  6100. The default setting for @p option is #STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW, where the remotely subscribed video stream falls back to the low-stream video (low resolution and low bitrate) under poor downlink network conditions.
  6101. If *option* is set as #STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK automatically switches the video from a high-stream to a low-stream, or disables the video when the downlink network conditions cannot support both audio and video to guarantee the quality of the audio. The SDK monitors the network quality and restores the video stream when the network conditions improve.
  6102. When the remotely subscribed video stream falls back to audio only or when the audio-only stream switches back to the video stream, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onRemoteSubscribeFallbackToAudioOnly "onRemoteSubscribeFallbackToAudioOnly" callback.
  6103. @param option Sets the fallback option for the remotely subscribed video stream. See #STREAM_FALLBACK_OPTIONS.
  6104. @return
  6105. - 0: Success.
  6106. - < 0: Failure.
  6107. */
  6108. int setRemoteSubscribeFallbackOption(STREAM_FALLBACK_OPTIONS option) {
  6109. return m_parameter ? m_parameter->setInt("rtc.remote_subscribe_fallback_option", option) : -ERR_NOT_INITIALIZED;
  6110. }
  6111. #if (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) || defined(_WIN32)
  6112. /** Enables loopback recording.
  6113. @param enabled Sets whether to enable/disable loopback recording:
  6114. - true: Enables loopback recording.
  6115. - false: (Default) Disables loopback recording.
  6116. @param deviceName Pointer to the device name of the sound card. The default value is NULL (the default sound card).
  6117. If you use a virtual sound card like "Soundflower", set this parameter as the name of the sound card, "Soundflower", and the SDK will find the corresponding sound card and start capturing.
  6118. @return
  6119. - 0: Success.
  6120. - < 0: Failure.
  6121. */
  6122. int enableLoopbackRecording(bool enabled, const char* deviceName = NULL) {
  6123. if (!deviceName) {
  6124. return setParameters("{\"che.audio.loopback.recording\":%s}", enabled ? "true" : "false");
  6125. }
  6126. else {
  6127. return setParameters("{\"che.audio.loopback.deviceName\":\"%s\",\"che.audio.loopback.recording\":%s}", deviceName, enabled ? "true" : "false");
  6128. }
  6129. }
  6130. #endif
  6131. /** Sets the volume of the in-ear monitor.
  6132. @param volume Sets the volume of the in-ear monitor. The value ranges between 0 and 100 (default).
  6133. @return
  6134. - 0: Success.
  6135. - < 0: Failure.
  6136. */
  6137. int setInEarMonitoringVolume(int volume) {
  6138. return m_parameter ? m_parameter->setInt("che.audio.headset.monitoring.parameter", volume) : -ERR_NOT_INITIALIZED;
  6139. }
  6140. protected:
  6141. AParameter& parameter() {
  6142. return m_parameter;
  6143. }
  6144. int setParameters(const char* format, ...) {
  6145. char buf[512];
  6146. va_list args;
  6147. va_start(args, format);
  6148. vsnprintf(buf, sizeof(buf)-1, format, args);
  6149. va_end(args);
  6150. return m_parameter ? m_parameter->setParameters(buf) : -ERR_NOT_INITIALIZED;
  6151. }
  6152. int setObject(const char* key, const char* format, ...) {
  6153. char buf[512];
  6154. va_list args;
  6155. va_start(args, format);
  6156. vsnprintf(buf, sizeof(buf)-1, format, args);
  6157. va_end(args);
  6158. return m_parameter ? m_parameter->setObject(key, buf) : -ERR_NOT_INITIALIZED;
  6159. }
  6160. int stopAllRemoteVideo() {
  6161. return m_parameter ? m_parameter->setBool("che.video.peer.stop_render", true) : -ERR_NOT_INITIALIZED;
  6162. }
  6163. private:
  6164. AParameter m_parameter;
  6165. };
  6166. } //namespace rtc
  6167. } // namespace agora
  6168. /** Retrieves the SDK version number.
  6169. @param build Build number of the Agora SDK.
  6170. @return String of the SDK version.
  6171. */
  6172. #define getAgoraRtcEngineVersion getAgoraSdkVersion
  6173. ////////////////////////////////////////////////////////
  6174. /** \addtogroup createAgoraRtcEngine
  6175. @{
  6176. */
  6177. ////////////////////////////////////////////////////////
  6178. /** Creates the RtcEngine object and returns the pointer.
  6179. @return Pointer to the RtcEngine object.
  6180. */
  6181. AGORA_API agora::rtc::IRtcEngine* AGORA_CALL createAgoraRtcEngine();
  6182. ////////////////////////////////////////////////////////
  6183. /** @} */
  6184. ////////////////////////////////////////////////////////
  6185. #define getAgoraRtcEngineErrorDescription getAgoraSdkErrorDescription
  6186. #define setAgoraRtcEngineExternalSymbolLoader setAgoraSdkExternalSymbolLoader
  6187. #endif