Skip to main content
Inspiring
August 29, 2013
Question

StageVideo on iOS Produces No Sound

  • August 29, 2013
  • 1 reply
  • 1796 views

I'm building an AIR for Mobile VOD application. This is the third time I've done this now and it's gone fairly smooth, until I got to testing out of the AIR emulator.

I am testing on an iPad 3/4 (unsure which, but it has a retina display) and iOS 6.x. I can playback the video just fine, but I get no sound. When using the iOS Simulator, I get the opposite on both iOS 6 and 7 (sound without video).

I'm using StageVideo and everything works fine in the simulator and on Android. The video also plays back just fine in Safari. StageWebView is not an option because the app requires custom player controls (I had originally planned on using it until I got revised designs from my designer).

Here is the load function:

public function load( url:String 😞void {

          trace( url );

          this._url = url;

          if ( this.isSupported ) {

                    this.stop();

                    this.sv = stage.stageVideos[0];

 

                    if ( !this.ns ) {

                              nc = new NetConnection();

                              nc.connect(null);

                              ns = new NetStream(nc);

                              ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

                              ns.client= this;

                    }

 

                    ns.play(url);

                    this.sv.attachNetStream( ns );

                    this.resizeHandler( null );

          }

}

Again, everything works perfectly in Android, desktop, and iOS Safari. Just not in-app on iOS. I've tried both GPU and Direct rendering modes and they made no difference. Is this a bug in AIR 3.8? Should I downgrade?

Build specs:

  • AIR 3.8.0.1280
  • Flex 4.10
  • iOS 6
  • OS X 10.8
  • Flash Builder 4.7
  • Tested 5 different videos, all encoded using h.264 and AAC
  • Streamed from both a remote server and a server set up on my machine, accessed using the local network. Also tried saving it to device (part of the app's functionality) and still had the same issue with local playback
This topic has been closed for replies.

1 reply

Inspiring
August 30, 2013

As an update, I have tested it on AIR 3.6 and AIR 3.7 as well as Flex 4.9 with both of them and I still get no sound. So that means one of the following:

  • This is a longstanding AIR bug (unlikely)
  • There is a problem with my iPad (unlikely)
  • I have something configured wrong with my app

Does anyone have any idea of any setting of compiler configuration that could be causing this? I'm at a loss here.

Inspiring
August 30, 2013

Okay, so I am a complete idiot. I have been troubleshooting this for a few hours now and of course the mute switch was on. I didn't even think about it for two reasons:

  • I didn't think AIR apps were affected by the mute switch. In fact, I've read several posts saying they weren't. My guess is AIR isn't, but StageVideo, which uses the native video capabilities, is. Honest mistake there
  • My personal iPad uses the mute switch to lock orientation so I forgot that it even worked as a mute switch

Crisis averted. Sorry if this lost anyone any time trying to figure out the problem. I do feel like a complete idiot here.

Colin Holgate
Inspiring
August 30, 2013

There is a setting you can use to honor the mute switch:

SoundMixer.audioPlaybackMode = AudioPlaybackMode.AMBIENT;

If you haven’t done that, then the mute switch shouldn’t be used.

The general case with iOS is that video doesn’t honor the switch, but all other app sounds do. If you were playing video with StageWebView, the audio might well have been heard.