odoo17 音视频扩展

ODOO内置了音视频服务,同时也提供了与第三方平台Twilio的接口,用以实现音视频的扩展:

Twilio是美国一家云通讯公司,算是云通讯领域的巨头企业,与同行业的公司以销售&营销进行投资来促进业务增长不同,Twilio则以API为基础,在数年内有机地打造了一个专业和广泛的软件开发员社区。

odoo原生代码:

复制代码
def _get_ice_servers(self):
    """
    :return: List of dict, each of which representing a stun or turn server,
            formatted as expected by the specifications of RTCConfiguration.iceServers
    """
    if self.env['ir.config_parameter'].sudo().get_param('mail.use_twilio_rtc_servers'):
        (account_sid, auth_token) = get_twilio_credentials(self.env)
        if account_sid and auth_token:
            url = f'https://api.twilio.com/2010-04-01/Accounts/{account_sid}/Tokens.json'
            response = requests.post(url, auth=(account_sid, auth_token), timeout=60)
            if response.ok:
                response_content = response.json()
                if response_content:
                    return response_content['ice_servers']
    return self._get_local_ice_servers()

class MailIceServer(models.Model):
    _name = 'mail.ice.server'
    _description = 'ICE server'

    server_type = fields.Selection([('stun', 'stun:'), ('turn', 'turn:')], string='Type', required=True, default='stun')
    uri = fields.Char('URI', required=True)
    username = fields.Char()
    credential = fields.Char()

    def _get_local_ice_servers(self):
        """
        :return: List of up to 5 dict, each of which representing a stun or turn server
        """
        # firefox has a hard cap of 5 ice servers
        ice_servers = self.sudo().search([], limit=5)
        formatted_ice_servers = []
        for ice_server in ice_servers:
            formatted_ice_server = {
                'urls': '%s:%s' % (ice_server.server_type, ice_server.uri),
            }
            if ice_server.username:
                formatted_ice_server['username'] = ice_server.username
            if ice_server.credential:
                formatted_ice_server['credential'] = ice_server.credential
            formatted_ice_servers.append(formatted_ice_server)
        return formatted_ice_servers

可以看到ODOO通过用户名和密码及API调用Twilio的第三方服务(Twilio按账号收费的)。

ODOO也可以通过二次开发的方式与其他音视频平台对接,但要考虑其对于ODOO自身带来的服务压力。

相关推荐
weixin_527550401 小时前
Linux 环境下高效视频切帧的实用指南
linux·运维·音视频
ai产品老杨1 小时前
减少交通拥堵、提高效率、改善交通安全的智慧交通开源了。
前端·vue.js·算法·ecmascript·音视频
红米饭配南瓜汤4 小时前
WebRTC中的几个Rtp*Sender
网络·网络协议·音视频·webrtc·媒体
EasyDSS7 小时前
EasyRTC嵌入式音视频通信SDK助力物联网/视频物联网音视频打造全场景应用
人工智能·音视频
aqi008 小时前
FFmpeg开发笔记(六十三)FFmpeg使用vvenc把视频转为H.266编码
ffmpeg·音视频·直播·流媒体
babytiger10 小时前
rk3588 上运行smolvlm-realtime-webcam,将视频转为文字描述
音视频
Icoolkj10 小时前
Komiko 视频到视频功能炸裂上线!
人工智能·音视频
sukalot10 小时前
window 显示驱动开发-DirectX 视频加速 2.0
音视频
冷凌爱10 小时前
每天总结一个html标签——Audio音频标签
前端·html·音视频
思通数科多模态大模型13 小时前
重构城市应急指挥布控策略 ——无人机智能视频监控的破局之道
人工智能·深度学习·安全·重构·数据挖掘·音视频·无人机