2

I have developed a sencha-phonegap application which comprise of playing videos already present in the application.

When I play any other video such as a video song through the native player, audio is heard perfectly from the stereo speakers present at the bottom.

I am simply using the xtype: video tag to play the video. Here's my code to play the video:

  {
   xtype    : 'video',
   x        : 0,
   y        : 0,
   left     :'0px',
   top      :'0px',
   width    : 175px,
   height   : 98px,
   url      : "path of video"
   posterUrl: 'placeholder.png'
  }

The problem which I am facing is that whenever the video is played, it only plays with sound when the earphones are connected and sometimes the audio can also be heard from the top-speaker (the speaker used during calls).

I have checked for the ringer and volume controls. Everything is at maximum. My app supports iOS versions 5.0 and above. Could this be iOS related issue?

Kindly provide some direction.

Thanx

madLokesh
  • 1,860
  • 23
  • 49

2 Answers2

2

Please first add Audio Toolbox and AVFoundation frameworks if not added already and than import class in which you add the below lines on app launch

 #import<AVFoundation/AVFoundation.h>

than add these two lines in your project when you app launches

UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);

May be it will work now.

Nishant Tyagi
  • 9,893
  • 3
  • 40
  • 61
1

On one of sencha forum, I found This Link Which Helped Me.

Since, it only specifically mentions about ringer off scenario, it also mentions in generic way that we need to add playback method for sound to work.

Cheers |m|

Community
  • 1
  • 1
madLokesh
  • 1,860
  • 23
  • 49