...
In this case RTMP connection will be closed if no data was received and sent in last 120 seconds.
RTMP stream picture rotation
When publishing RTMP stream to WCS, stream picture can be rotated using RTMP metadata. It may be useful for picture handling from mobile publishers.
To turn a picture to a certain angle RTMP metadata containing ‘orientation’ field should be sent. The following orientations are supported:
Значение поля | Угол поворота в градусах |
0 | 0 |
1 | 90 |
2 | 180 |
3 | 270 |
A picture is rotated clockwise.
Set up
To enable stream rotation, set the following parameter in flashphoner.properties file:
Code Block | ||
---|---|---|
| ||
video_filter_enable_rotate=true |
Note that stream rotation works for transcoded streams only.
Testing
1. For test we use:
- WCS server with picture rotation enabled
- Flash Streaming application to publish and rotate the stream
- Player application to play the stream
2. Open Flash Streaming application. Set stream name test and desired stream publishing parameters:
3. Click Login then Start. Stream publishing begins
4. Open Player application in anoter tab or browser, play the stream named test
5. In Flash Streaming application click 180 button in Rotate camera section. The stream rotated to 180 degrees clockwise will be displayed in Player application
To developer
Stream orientation metadata sending is implemented in Flash Streaming application as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
private function rotate(degree:Number):void {
var metaDataObj:Object = new Object();
switch(degree) {
case 0:
Logger.info("rotate camera to 0");
metaDataObj.orientation = 0;
break;
case 90:
Logger.info("rotate camera to 90");
metaDataObj.orientation = 1;
break;
case 180:
Logger.info("rotate camera to 180");
metaDataObj.orientation = 2;
break;
case 270:
Logger.info("rotate camera to 270");
metaDataObj.orientation = 3;
break;
default:
metaDataObj.orientation = 0;
break;
}
sendMetaData(metaDataObj);
}
private function sendMetaData(data:Object):void{
if (publishStream != null) {
publishStream.send("@setDataFrame", "onMetaData", data);
}
} |
Note that orientation value should be sent but not angle itself.
Known issues
Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
...