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 / CloudRecordController.cs
Created December 12, 2020 01:21
Cloud Record Controller class
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
using System.Collections;
using System.Collections.Generic;
public class CloudRecordController : MonoBehaviour
{
[SerializeField]
string ServerURL = default;
@icywind
icywind / CloudRecordModel.cs
Created December 11, 2020 03:07
Cloud Record API Responses
using UnityEngine;
using System;
// Returns json {"resourceId":"xxxx", "sid":"yyy", "serverResponse":{"status":5,"fileList":"zzzz.m3u8","fileListMode":"string","sliceStartTime":1606357122528} }
[Serializable]
public class CloudRecordResponseModel
{
public string resourceId;
@icywind
icywind / stop.php
Created December 11, 2020 00:56
Stop the cloud recording
<?php
require_once("config.php");
$curl = curl_init();
// Receive ResourceID and sid from client
$ResourceID = $_POST["resourceId"];
$Channel = $_POST["channel"];
@icywind
icywind / query.php
Created December 11, 2020 00:52
Query the cloud recording session
<?php
require_once("config.php");
$curl = curl_init();
// Receive ResourceID and sid from client
$ResourceID = $_POST["resourceId"];
$Channel = $_POST["sid"];
curl_setopt_array($curl, array(
@icywind
icywind / start.php
Created December 11, 2020 00:41
Start recording
<?php
require_once("config.php");
$curl = curl_init();
// Receive ResourceID from client
$ResourceID = $_POST["resourceId"];
$Channel = $_POST["channel"];
@icywind
icywind / acquire.php
Created December 11, 2020 00:35
Acquire a cloud record resource id
<?php
require_once("config.php");
$Channel = $_POST["channel"];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.agora.io/v1/apps/$AppID/cloud_recording/acquire",
CURLOPT_RETURNTRANSFER => true,
@icywind
icywind / config.php
Created December 11, 2020 00:32
The configuration variables definition
<?php
// Agora
$AppID = "";
$CustomerID="";
$CustomerSecret="";
$AuthSecret = base64_encode("$CustomerID:$CustomerSecret");
// You define
$RecUID = "889988";