Skip to content

Instantly share code, notes, and snippets.

View icywind's full-sized avatar

Rick Cheng icywind

View GitHub Profile
@icywind
icywind / convmp3.bash
Created January 8, 2024 22:22
Shell script to convert mp4 files to mp3 using ffmpeg
#!/bin/bash
for filename in *.mp4; do
mp3="${filename%.mp4}.mp3"
echo "$filename ===> $mp3"
ffmpeg -i $filename -vn $mp3
done
ExtraModuleNames.Add(“AgoraUnrealSample”);
ExtraModuleNames.Add(“AgoraPlugin”);
if (Target.Platform == UnrealTargetPlatform.IOS || Target.Platform == UnrealTargetPlatform.Mac)
{
bOverrideBuildEnvironment = true;
AdditionalCompilerArguments = “-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor”;
}
@icywind
icywind / String2Array.cs
Last active August 25, 2023 00:34
C# to read python format string
// input: [1,2]
public static int[] ParseOneDimArray(string str)
{
string text = str.Substring(1, str.Length-2);
int [] arrayint = text.Split(',').Select(x=> int.Parse(x)).ToArray();
return arrayint;
}
// input: [[1,2],[3,4]]
public static int[][] ParseTwoDimArray(string str)
@icywind
icywind / ShareScreenMac.mm
Last active December 3, 2021 03:32
A library source to return a list of screen ids
//
// ShareScreenMac.mm
// ShareScreenLib
//
// Created by Rick Cheng on 4/17/20.
// Copyright © 2020 Agora. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
@icywind
icywind / VideoSurface.cs
Created December 10, 2019 04:51
Updated version of VideoSurface to use RawImage for rendering.
using UnityEngine;
using System.Runtime.InteropServices;
using UnityEngine.UI;
/**!! This version of the script is non-official. use it on your own risk! */
/*
* This example script demonstrates how to attachThis example
* video content to a 3D object (chenzhenyong@agora.io)
*
using UnityEngine;
using UnityEngine.UI;
using agora_gaming_rtc;
using agora_utilities;
using System;
using System.Collections;
// this is an example of using Agora Unity SDK
@icywind
icywind / AgoraVideoChat_PushVideo.cs
Last active April 16, 2021 00:40
Use external video source to push video frame
#region =========== Push Video =================
public const TextureFormat ConvertFormat = TextureFormat.BGRA32; // RGBA will be compatible with Web
public const VIDEO_PIXEL_FORMAT PixelFormat = VIDEO_PIXEL_FORMAT.VIDEO_PIXEL_BGRA; // note: RGBA is available from v3.0.1 and on
Texture2D BufferTexture;
bool _isRunning;
IEnumerator CoShareRenderData()
{
@icywind
icywind / AgoraPushFrame.cs
Last active March 17, 2021 18:27
How to push external video source frame with a coroutine
// Push frame to the remote client
IEnumerator PushFrame(byte[] bytes, int width, int height, System.Action onFinish)
{
if (bytes == null || bytes.Length == 0)
{
Debug.LogError("Zero bytes found!!!!");
yield break;
}
IRtcEngine rtc = IRtcEngine.QueryEngine();
public string AppID;
public string ChannelName;
VideoSurface myView;
VideoSurface remoteView;
IRtcEngine mRtcEngine;
void Awake()
{
// SetupUI();
@icywind
icywind / ARClientCaptureARBuffer.cs
Last active January 21, 2021 13:42
Interface for Agora Video Chat clients
// Get Image from the AR Camera, extract the raw data from the image
private unsafe void CaptureARBuffer()
{
// Get the image in the ARSubsystemManager.cameraFrameReceived callback
XRCameraImage image;
if (!cameraManager.TryGetLatestImage(out image))
{
Debug.LogWarning("Capture AR Buffer returns nothing!!!!!!");
return;