Android 解决阿里云直播水印问题

设置水印目标位置

String waterMark = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/com.xxxx.android/watermark.png";

保存图片到位置

Resources res = getResources();
Bitmap mBitmap = BitmapFactory.decodeResource(res, R.drawable.watermark);

public static String saveBitmapToSDCard(Bitmap bitmap, String path) {
       FileOutputStream fos;
      try {
          fos = new FileOutputStream(path);
          if (fos != null) {
              bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
              fos.close();
          }
          return path;
      } catch (Exception e) {
          e.printStackTrace();
     }
  return null;
}

设置水印

   mAlivcLivePushConfig.addWaterMark(waterMark, 0.8f, 0.9f, 0.15f);

你可能感兴趣的:(Android 解决阿里云直播水印问题)