Android中的实时视频广播

时间:2018-04-26 11:54:01

标签: android video webrtc android-broadcast

您好我正在开发应用程序,我需要在Facebook和YouTube上播放实时视频。所有我都知道Facebook和YouTube提供clock-frequency

现在我需要将public class DBHelper extends SQLiteOpenHelper{ //USER TABLE public static final String USER_TABLE_NAME = "MyTableTwo"; public static final String USER_COLUMN_USER_ID = "id"; public static final String USER_COLUMN_USER_NAME = "Item_Name"; public static final String USER_COLUMN_USER_ADDRESS = "Weight"; public static final String USER_COLUMN_USER_CREATED_AT = "MRP"; public static final String USER_COLUMN_USER_UPDATED_AT = "BARCODE"; public DBHelper(Context context, String dbName, Integer version) { super(context, dbName, null, version); } @Override public void onCreate(SQLiteDatabase db) { tableCreateStatements(db); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + USER_TABLE_NAME); onCreate(db); } private void tableCreateStatements(SQLiteDatabase db) { try { db.execSQL( "CREATE TABLE IF NOT EXISTS " + USER_TABLE_NAME + "(" + USER_COLUMN_USER_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + USER_COLUMN_USER_NAME + " VARCHAR(20), " + USER_COLUMN_USER_ADDRESS + " VARCHAR(50), " + USER_COLUMN_USER_CREATED_AT + " VARCHAR(10) DEFAULT " + getCurrentTimeStamp() + ", " + USER_COLUMN_USER_UPDATED_AT + " VARCHAR(10) DEFAULT " + getCurrentTimeStamp() + ")" ); } catch (SQLException e) { e.printStackTrace(); } } public List<MyTableTwo> getMyItems() { List<MyTableTwo> mySuperList = new ArrayList<>(); SQLiteDatabase db = this.getReadableDatabase(); String selectQuery = "SELECT * FROM " + USER_TABLE_NAME ; Cursor c = db.rawQuery(selectQuery, null); if (c != null) { c.moveToFirst(); while (c.isAfterLast() == false) { MyTableTwo myTable = new MyTableTwo(); myTable.itemName = (c.getString(c.getColumnIndex("Item_Name"))); myTable.weight = (c.getString(c.getColumnIndex("Weight"))); myTable.mrp = (c.getString(c.getColumnIndex("MRP"))); myTable.barcod = (c.getString(c.getColumnIndex("BARCODE"))); mySuperList.add(myTable); c.moveToNext(); } } return mySuperList; } public Long insertUser(MyTableTwo user) throws Exception { try { SQLiteDatabase db = this.getWritableDatabase(); ContentValues contentValues = new ContentValues(); contentValues.put(USER_COLUMN_USER_NAME, user.itemName); contentValues.put(USER_COLUMN_USER_ADDRESS, user.barcod); contentValues.put(USER_COLUMN_USER_CREATED_AT, user.weight); contentValues.put(USER_COLUMN_USER_UPDATED_AT, user.barcod); return db.insert(USER_TABLE_NAME, null, contentValues); } catch (Exception e) { e.printStackTrace(); throw e; } } private String getCurrentTimeStamp() { return String.valueOf(System.currentTimeMillis() / 1000); } 传递给RTMP URL客户端。 WebRTC官方网站说 -

  

运行AppRTCMobile App AppRTCMobile是一款Android应用程序   通过JNI使用WebRTC Native API(这里记录了JNI包装器)。

。对于JNI,我需要包含NDK,这将使app变得沉重。 webRTC是唯一的方式吗?任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:3)

我最近参与了一个项目,我在项目下面整合了相同的要求 -

  • LiveVideoBroadcaster

    它是免费的,OpenSource在 GitHub 上有效。您所需要的只是提供您将从Facebook / YouTube获得的RTMP网址。

对于Facebook,请参阅here,对于YouTube,请参阅here