cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sterling Nelson (JIRA)" <>
Subject [jira] [Commented] (CB-7708) HTML5 video playback in iOS is muted by ringer switch
Date Fri, 03 Oct 2014 19:46:34 GMT


Sterling Nelson commented on CB-7708:

Thanks for the quick response!

I was able to modify Cordova's viewController such that video playback behaved like I wanted:
I edited '(project/ios-build)/CordovaLib/Classes/CDVViewController.m' in place by placing
this snippet in the "viewDidLoad" handler:
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
BOOL ok;
NSError *setCategoryError = nil;
ok = [audioSession setCategory:AVAudioSessionCategoryPlayback
if (!ok) {
  NSLog(@"%s setCategoryError=%@", __PRETTY_FUNCTION__, setCategoryError);
Our videos did then ignored the mute switch as Apple's docs for [AVAudioSessionCategoryPlayback|]
describe.  However, my understanding of Objective-C and Cordova initialization is pretty much
nonexistent, so I'm not sure if I'm clobbering anything else by doing this.  If I am not doing
anything dangerously stupid here, I've still got issues wherein I don't want to depend on
a specific non-standard version of a standard Cordova file.  Is there somewhere i could hook
in (as a plugin maybe?) to get this code into Cordova's webview init?

> HTML5 video playback in iOS is muted by ringer switch
> -----------------------------------------------------
>                 Key: CB-7708
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 3.5.0
>         Environment: iOS 7, iOS 8
>            Reporter: Sterling Nelson
>            Priority: Minor
> We've got a Cordova based iOS app (targeted for iOS7 and 8) that plays back a fair amount
of media content as HTML5 video.  We've been having issues with video not playing sound for
some users.  I suspect some of the issues are related to device ringers being set to mute
(which does not seem to affect video playback in Safari), and would like to cross these cases
out.  From my perspective it'd be nice if behavior of the HTML5 video element in iOS WebViews
matched its Safari behavior.  
> I managed to get the behavior I would like by fiddling with the Cordova default view
controller, but I would rather not modify Cordova's controllers in place (in part because
it seems wrong, but mostly because we'd like to be able to re-build our Cordova app without
having to worry about modifying library files.)
> Is there currently something I should configure to have Cordova just do this for me?
I see that the Media plugin does something similar to this, but couldn't find anything like
it documented for video.  If this is not currently set-able, are there particular plans to
implement (or never do so)?
> We're using Cordova 3.5.0-0.2.7.  I'm happy to provide more info about the fiddling I've
done thus far.
> Thanks!
> Sterling Nelson <>
> edit: badly placed line breaks

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message