if (andReturn) {
final PendingCall call = new PendingCall(null, CALL_ON_STATUS, new Object[] { status });
if (status.getCode().equals(StatusCodes.NS_PLAY_START)) {
IScope scope = connection.getScope();
if (scope.getContext().getApplicationContext().containsBean(IRtmpSampleAccess.BEAN_NAME)) {
IRtmpSampleAccess sampleAccess = (IRtmpSampleAccess) scope.getContext().getApplicationContext().getBean(IRtmpSampleAccess.BEAN_NAME);
boolean videoAccess = sampleAccess.isVideoAllowed(scope);
boolean audioAccess = sampleAccess.isAudioAllowed(scope);
if (videoAccess || audioAccess) {
final Call call2 = new Call(null, "|RtmpSampleAccess", null);
Notify notify = new Notify();
notify.setCall(call2);
notify.setData(IoBuffer.wrap(new byte[] { 0x01, (byte) (audioAccess ? 0x01 : 0x00), 0x01, (byte) (videoAccess ? 0x01 : 0x00) }));