Giter Site home page Giter Site logo

anendi's Introduction

ANENDI

Let AdobeAIR screen/image pass to OBS via NDI(https://ndi.video/for-developers/ndi-sdk/)

example:
if (ANENDI.getInstance().isSupported)
{
	if (ndi)
	{
		ndi.destroy();
		ndiTimer.stop();
		ndiTimer.removeEventListener(TimerEvent.TIMER, ndiAppendFrame);
		ndiTimer = null;
		ndi = null;
		return;
	}
	ndi = ANENDI.getInstance().create_NDI("air_test1" + Math.random());
	if (ndi)
	{
		trace(ndi.intptr, ndi.name);
		
		if (!ndiTimer)
		{
			ndiTimer = new Timer(1000 / 24);
			ndiTimer.addEventListener(TimerEvent.TIMER, ndiAppendFrame);
			ndiTimer.start();
		}
	}
}
else
{
	trace("不支持ndi");
}

private function ndiAppendFrame(e:TimerEvent):void
{
	var byte:ByteArray = new ByteArray();
	var bitemapdata:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false);
	bitemapdata.draw(stage, null, null, null, null, true);
	byte.endian = Endian.LITTLE_ENDIAN;
	bitemapdata.copyPixelsToByteArray(bitemapdata.rect, byte);
	
	ndi.sendByteArray(byte, bitemapdata.width, bitemapdata.height);
	
	byte.clear();
}
Notice:

Don't forget to copy "runtime-dll/x86" (according to the architecture) to the application runtime directory

Debug:Please copy it to the AIRSDK/bin directory when debugging.

anendi's People

Contributors

raygyoe avatar

Watchers

 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.