[ 
https://issues.apache.org/jira/browse/CB-7708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14158429#comment-14158429
 ] 

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:
{noformat}
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
BOOL ok;
NSError *setCategoryError = nil;
ok = [audioSession setCategory:AVAudioSessionCategoryPlayback
                     error:&setCategoryError];
if (!ok) {
  NSLog(@"%s setCategoryError=%@", __PRETTY_FUNCTION__, setCategoryError);
}
{noformat}
Our videos did then ignored the mute switch as Apple's docs for 
[AVAudioSessionCategoryPlayback|https://developer.apple.com/library/ios/documentation/avfoundation/reference/avaudiosession_classreference/index.html#//apple_ref/doc/constant_group/Audio_Session_Categories]
 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: https://issues.apache.org/jira/browse/CB-7708
>             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 <[email protected]>
> edit: badly placed line breaks



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to