Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Starting with iOS 6, you MUST set the audio session category to 'playback' before creating the UIWebView. This is all you have to do. It is not necessary to make the session active.</p> <p>This should be used for html video as well, because if you don't configure the session, your video will be muted when the ringer switch is off.</p> <pre><code>#import &lt;AVFoundation/AVFoundation.h&gt; AVAudioSession *audioSession = [AVAudioSession sharedInstance]; BOOL ok; NSError *setCategoryError = nil; ok = [audioSession setCategory:AVAudioSessionCategoryPlayback error:&amp;setCategoryError]; if (!ok) { NSLog(@"%s setCategoryError=%@", __PRETTY_FUNCTION__, setCategoryError); } </code></pre> <p>Ensure that your target links to the AVFoundation framework.</p> <hr> <p>If using Cordova, the file you need to modify is <code>platforms/ios/MyApp/Classes/AppDelegate.m</code>, and will end up looking like this:</p> <pre><code>#import "AppDelegate.h" #import "MainViewController.h" #import &lt;AVFoundation/AVFoundation.h&gt; @implementation AppDelegate - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { AVAudioSession *audioSession = [AVAudioSession sharedInstance]; BOOL ok; NSError *setCategoryError = nil; ok = [audioSession setCategory:AVAudioSessionCategoryPlayback error:&amp;setCategoryError]; if (!ok) { NSLog(@"%s setCategoryError=%@", __PRETTY_FUNCTION__, setCategoryError); } self.viewController = [[MainViewController alloc] init]; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } @end </code></pre> <p>Also, as mentioned in the comments, you need to link the AVFoundation Framework, as explained in <a href="https://stackoverflow.com/questions/19337890/how-to-add-an-existing-framework-in-xcode-5/19337932#19337932">this answer</a>:</p> <ul> <li>Open your project with xcode <code>open ./platforms/ios/MyApp.xcworkspace/</code> </li> <li>Project navigator > target My App > General</li> <li>Scroll to the bottom to find Linked Frameworks and Libraries</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload