Untitled
unknown
python
3 years ago
2.7 kB
8
Indexable
import os
import aminofix as amino
client = amino.Client()
email="ayatoil.com"
secret=" 1666531265 2IOYP4bDPJ-FrXvDS__IdrBUA34"
import requests
import json
import threading
import time
from pprint import pprint
comId="195570892"
#sid="AnsiMSI6IG51bGwsICIwIjogMiwgIjMiOiAwLCAiMiI6ICIyNTY2M2JkMy0zNjg4LTRmNzMtYTJhYi04NTQ4YjBiMGNkMjkiLCAiNSI6IDE2NjQ1NjQwNjEsICI0IjogIjEwMy4yMDEuMTM0Ljk4IiwgIjYiOiAxMDB92dXyfsgc-ULfGLVuZuLnms4T9Cs"
#client.login_sid(sid)
client.login_secret(secret)
import agorartc
import sys
from flask import Flask, request
current=[1]
class MyRtcEngineEventHandler(agorartc.RtcEngineEventHandlerBase):
def __init__(self, rtc):
super().__init__()
self.rtc = rtc
def onWarning(self, warn, msg):
if warn != 1031:
print(f"warn: {warn}")
def onError(self, err, msg):
print(f"err: {err}")
def onJoinChannelSuccess(self, channel, uid, elapsed):
print("onJoinChannelSuccess")
rtc.muteLocalAudioStream(True)
def onRejoinChannelSuccess(self, channel, uid, elapsed):
print("onRejoinChannelSuccess")
def onLeaveChannel(self, stats):
print("onLeaveChannel")
def onAudioMixingStateChanged(self,state,reason):
print(state)
if int(state)==710:
rtc.muteLocalAudioStream(False)
current.clear()
current.append(0)
if int(state)==713:
rtc.muteLocalAudioStream(True)
current.clear()
current.append(1)
print("compleated")
rtc = agorartc.createRtcEngineBridge()
eventHandler = MyRtcEngineEventHandler(rtc)
rtc.initEventHandler(eventHandler)
rtc.initialize("d544b053e3e94dd2a8f51c6668522372", None, agorartc.AREA_CODE_GLOB & 0xFFFFFFFF)
rtc.enableAudio()
rtc.enableVideo()
chat="http://aminoapps.com/p/0tjx8mp"
bb=client.get_from_code(chat)
def vc(comid: str, chatid: str):
comid = str(comid)
data = '{"o":{"ndcId":'+comid+',"threadId":"'+chatid+'","joinRole":1,"id":"2249844"},"t":112}'
client.send(data)
data = '{"o":{"ndcId":'+comid+',"threadId":"'+chatid+'","channelType":5,"id":"2250161"},"t":108}'
client.send(data)
time.sleep(3)
data = '{"o":{"ndcId":'+comid+',"threadId":'+chatid+',"id":"337496"},"t":200}'
client.send(data)
id=bb.objectId
cid=bb.path[1:bb.path.index("/")]
@client.event("on_fetch_channel")
def on_chat_invite(data):
token=data.json
print(token)
rtc.joinChannel(token['channelKey'], token['channelName'], '', int(token['channelUid']))
#rtc.startPreview()
rtc.enableVideo()
rtc.muteLocalAudioStream(True)
time.sleep(2)
vc(cid,id)Editor is loading...