Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

AIR for iOS NetStream Video Volume Control

Open Seb-AS opened this issue 8 years ago • 6 comments
trafficstars

AIR for iOS NetStream Video Volume Control

https://bugbase.adobe.com/index.cfm?event=bug&id=4196944

I'm loading and running an MP4 just fine in AIR for iOS. The problem I am having is controlling the volume (muting / unmuting).

I am using soundTransform on the NetStream object, but it is having no effect. It's not erroring either.

var transform:SoundTransform = new SoundTransform();
transform.volume = 0;
netStream.soundTransform = transform;

There is an old problem from Air 3.0.

Note: This property is not supported for H.264 video in AIR 3.0 for iOS.

Seb-AS avatar Aug 20 '17 23:08 Seb-AS

Sebastian, could you please add the latest AIR version you've been using when reproducing this problem? Thx in advance!!

PrimaryFeather avatar Aug 21 '17 09:08 PrimaryFeather

Sure Daniel, Last time I tried it was on AIR 25.

thanks

Seb-AS avatar Aug 21 '17 14:08 Seb-AS

Are you seeing any issues with AIR 27, 28, 29 or 30?

urthling avatar Jun 07 '18 18:06 urthling

@ajwfrost Issue still exists with latest AIR 51.0.1.1. Tested with VideoTexture. To reproduce this issue you could use sample from https://github.com/airsdk/Adobe-Runtime-Support/issues/1939 (just change video with sound).

itlancer avatar May 20 '24 08:05 itlancer

@itlancer thanks for the reminder -> to confirm, is this for MP4 videos (rather than e.g. FLV)? Per that other issue, there are different code paths used for playing these back on iOS, so it may be a separate bit of glue needs to be added to ensure any NetStream sound transform is then applied to the media...

ajwfrost avatar May 21 '24 09:05 ajwfrost

to confirm, is this for MP4 videos (rather than e.g. FLV)?

@ajwfrost Yes, this is for MP4 H.264 (tested with multiple different videos). I didn't test this issue with FLV.

itlancer avatar May 21 '24 09:05 itlancer

@ajwfrost With AIR 51.0.1.4 now it works but only if soundTransform applied after NetStream::play() call. It doesn't work in other case. Here sample:

package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.NetConnection;
	import flash.net.NetStream;
	import flash.media.StageVideo;
	import flash.geom.Rectangle;
	import flash.events.NetStatusEvent;
	import flash.media.SoundTransform;
	
	public class SoundTransformVolumeIosBug extends Sprite {
		private var nc:NetConnection;
		private var ns:NetStream;
		
		public function SoundTransformVolumeIosBug() {
			addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			nc = new NetConnection();
			nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
			nc.connect(null);
		}
		
		private function netStatusHandler(event:NetStatusEvent):void {
			trace(event.info.code);
			switch (event.info.code){
				case "NetConnection.Connect.Success":
					ns = new NetStream(nc);
					ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
					ns.client = {onMetaData:getMeta, onPlayStatus:onPlayStatus};
					var sv:StageVideo = stage.stageVideos[0];
					sv.viewPort = new Rectangle(0, 0, 1280, 800);
					
					var st:SoundTransform = new SoundTransform(0);
					ns.soundTransform = st;//This line do nothing for iOS devices
					
					sv.attachNetStream(ns);
					
					ns.play("video.mp4");
					//ns.soundTransform = st;//Here it works
					break;
			}
		}
		
		private function getMeta(mdata:Object):void { }
		
		//Seek video to begin after complete
		private function onPlayStatus(infoObject:Object):void {
			ns.seek(0);
		}
	}
}

Related issues: https://github.com/airsdk/Adobe-Runtime-Support/issues/1939 https://github.com/airsdk/Adobe-Runtime-Support/issues/3260

itlancer avatar Jul 24 '24 22:07 itlancer