Giter Site home page Giter Site logo

yszx123 / cordova-plugin-rongcloud-im-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rongcloud-archive/cordova-plugin-rongcloud-im-demo

0.0 2.0 0.0 2.33 MB

Demo of RongCloud IMLib Plugin for Cordova.

License: MIT License

JavaScript 82.48% CSS 17.04% HTML 0.48%

cordova-plugin-rongcloud-im-demo's Introduction

融云 RongCloud Cordova IM v2.0

Environment Setup

初始化开发工具

npm install -g cordova ionic

如有必要,使用 sudo npm

安装依赖库

在项目根目录下执行:

npm install
ionic state restore

特别说明

1.发送语音信息需要注意:demo中用到了cordova-plugin-media,这个插件需要在android和ios的源码中修改几个参数 发送语音需要长按 喇叭按钮

2.如果没有测试帐号,请在 http://webim.demo.rong.io/WebIMDemo/login.html 注册

3.demo中没有加好友和群的功能,如果需要这两项操作,请在官网 http://www.rongcloud.cn/downloads 最下端下载安卓或ios的app,用您注册的帐号登录

ios

appFolder/platforms/ios/appFolder/Plugins/cordova-plugin-media/CDVSound.m audioFile.recorder前加入

NSDictionary *recordSetting = @{AVFormatIDKey: @(kAudioFormatLinearPCM),
                               AVSampleRateKey: @8000.00f,
                               AVNumberOfChannelsKey: @1,
                               AVLinearPCMBitDepthKey: @16,
                               AVLinearPCMIsNonInterleaved: @NO,
                               AVLinearPCMIsFloatKey: @NO,
                               AVLinearPCMIsBigEndianKey: @NO};

改完后结果为

NSDictionary *recordSetting = @{AVFormatIDKey: @(kAudioFormatLinearPCM),
                               AVSampleRateKey: @8000.00f,
                               AVNumberOfChannelsKey: @1,
                               AVLinearPCMBitDepthKey: @16,
                               AVLinearPCMIsNonInterleaved: @NO,
                               AVLinearPCMIsFloatKey: @NO,
                               AVLinearPCMIsBigEndianKey: @NO};
audioFile.recorder = [[CDVAudioRecorder alloc] initWithURL:audioFile.resourceURL settings:recordSetting error:&error];

android

appfoldere/platforms/android/src/org/apache/cordova/media/AudioPlayer.java 中 startRecording中 case NONE:中加入并替换为

   this.recorder.setAudioSamplingRate(8000);
   this.recorder.setAudioEncodingBitRate(7950);
   this.recorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
   this.recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

cordova-plugin-rongcloud-im-demo's People

Contributors

ericyangpan avatar

Watchers

James Cloos avatar 张晓培 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.