Play Audio on Android - android

Answers to many questions about this theme doesn't help me! It's not the problem that audio needs to be started first by a click or any other type of action.
I want to Play a number of different short mp3's on my website. The best approach I've found is the following. It works on Internet Explorer and Chrome (other Desktop browsers not tested) and on mobile devices with iOS. But not on Android.
In my html I initialize an audio device:
<audio id="mp3play" src=""></audio>
It's only for defining the name "mp3play".
In the header of the html I have the following javascript:
<SCRIPT language=JavaScript>
<!--
function play(name) {
var oAudio = document.getElementById("mp3play");
oAudio.stop;
oAudio.src = name;
oAudio.play();
}
//-->
Now I can invoke the player with the following link:
<a href="javascript:play('stuff/voc/WAVvow/011001.MP3');"
This works fine, even on Android.
But for special requirements I do not use filenames for mp3's. I've made a Perl script to deliver the pm3 data depending on a computation. For this I use the following link:
<a href="javascript:play('../cgi-bin/playmp3.pl?185004');"
This Perl code "playmp3.pl" sends a header and then the complete mp3 data:
($entry[0] has a pointer to the desired data, $entry[1] the length)
open(DAT, "<../wbtde/DictData/dv8.dat");
binmode DAT;
seek(DAT, $entry[0], 0);
read(DAT, $mp3, $entry[1]); # Lesen des Eintrages
close DAT;
print "Content-type: audio/mpeg\n\n";
print $mp3;
Also this works fine on IE, Chrome and iOS browsers, but not on Android.
I can invoke the script also directly with
www.mysite.com/cgi-bin/playmp3.pl?185004
Also this is working fine on IE, Chrome and iOS browser, but not on Android. Android tells me it can not play this type of content. But with content type audio/mpeg3 it's also not playing.
This is the Android error log when I tap one link only:
D/CDX_Player( 2402): >>>>>>>> CedarX Player Version: 00010707
I/CedarPlayerWrapper( 2402): setDataSource('http://www.example.com/cgi-bin/playmp3.pl?062013')
I/ChromiumHTTPDataSource( 2402): connect to http://www.example.com/cgi-bin/playmp3.pl?062013 #0
W/MediaPlayer( 967): info/warning (701, 0)
I/MediaPlayer( 967): Info (701,0)
D/sft_http_stream( 2402): reset stream
I/NuCachedSource2( 2402): ERROR_END_OF_STREAM
W/demux_http( 2402): unknown file format!
E/demux_http( 2402): open error, destroy stream handle
E/DemuxSftNetwork_Component( 2402): cedar demuxer open error
E/CedarXPlayer( 2402): CedarXPlayer:prepare error!
E/MediaPlayer( 967): error (1, -2147483648)
E/MediaPlayer( 967): Error (1,-2147483648)
I/CDX_Player( 2402): cancel prepare!
D/CDX_Player( 2402): >>>>>>>> CedarX Player Version: 00010707
I/CedarPlayerWrapper( 2402): setDataSource('http://www.example.com/cgi-bin/playmp3.pl?062013')
W/MediaPlayer( 967): info/warning (701, 0)
I/ChromiumHTTPDataSource( 2402): connect to http://www.example.com/cgi-bin/playmp3.pl?062013 #0
I/MediaPlayer( 967): Info (701,0)
D/sft_http_stream( 2402): reset stream
I/NuCachedSource2( 2402): ERROR_END_OF_STREAM
W/demux_http( 2402): unknown file format!
E/demux_http( 2402): open error, destroy stream handle
E/DemuxSftNetwork_Component( 2402): cedar demuxer open error
E/CedarXPlayer( 2402): CedarXPlayer:prepare error!
E/MediaPlayer( 967): error (1, -2147483648)
E/MediaPlayer( 967): Error (1,-2147483648)
I/CDX_Player( 2402): cancel prepare!
Another try:
I've saved the output from Perl script to a file with the name "test.MP3". Then I've prepared a link in my html as
<a href="javascript:play('stuff/test.MP3');"
This works on Android! So I can assume that the output of the Perl script is correct.
Is it a question of content type?
Is it a question of the filename (.pl instead of mp3)?

It is the Filename!
Fortunately Android accepts the addition ".mp3" to the Perl call:
www.mysite.com/cgi-bin/playmp3.pl?185004.mp3
I've changed the Perl script to remove that addition and now it works on all platforms.

Related

Mediacodec for decoding H264 stream failed to create on Nexus 6P

I have an application (decoding module) which fails to create mediacodec for decoding H264 encoded stream while running on the Nexus 6P. But it perfectly works under Google PIXEL XL phone.
I am also giving a small snap of the error I am getting while I debug it using android studio logcat. Any Help will be highly appreciated.
Error Snap
E/OMX-VDEC-1080P: Failed to call stream on OUTPUT due to HW_OVERLOAD
E/OMX-VDEC-1080P: empty_this_buffer_proxy failure due to HW overload
E/OMX-VDEC-1080P: ERROR: Sending OMX_ErrorInsufficientResources to Client
E/OMX-VDEC-1080P: Failed to qbuf to driver
E/ACodec: [OMX.qcom.video.decoder.avc] ERROR(0x80001000)
E/ACodec: signalError(omxError 0x80001000, internalError -2147483648)
Codec reported err 0x80001000, actionCode 0, while in state 6
E/NuPlayerDecoder: Decoder (video) reported error : 0x80001000
E/NuPlayer: received error(0x80001000) from video decoder, flushing(0), now shutting down
E/MediaPlayer: error (1, -2147479552)
E/MediaPlayer: Error (1,-2147479552)
D/EasyMovieTexture: OnError
E/NuPlayerDecoder: failed to flush OMX.qcom.video.decoder.avc (err=-38)
12-29 20:21:41.075 2737-10644/? E/NuPlayer: received error(0xffffffda) from video decoder, flushing(2), now shutting down
D/NuPlayerDriver: notifyListener_l(0xeed2aae0), (100, 1, -38), loop setting(0, 0)
E/MediaPlayer: Error (1,-38)
D/EasyMovieTexture: OnError
E/OMX-VDEC-1080P: Failed to call stream on OUTPUT
E/OMX-VDEC-1080P: empty_this_buffer_proxy failure
I guess error code -38 is coming because I want to start the mediaplayer in an incorrect state (Here as the codec is giving me an error, mediaplayer is in the ERROR state).
I tested on Google PIXEL XL and Nexus 6P and I am getting this problem for Nexus 6P.

Error from MediaPlayer playing HLS live stream in Android 5.1

I'm getting an odd error from MediaPlayer while playing a live stream. The code was working perfectly before I upgraded my Nexus 10 to 5.1 from 5.0.x.
I get the error: error (-2147483648, 0) in the onError handler and have to stop the video. If I put a breakpoint in the error handler, the video plays perfectly on the device, so I don't know why it throws the error nor what it means.
I've tried debugging the MediaPlayer sources, but for some reason the binary on the device does not match the sources I have for 5.1. Either way it seems the error is coming up from the Native code.
I am able to play other media sources with he same code, it seems only the media with no duration information causes the error.
Here is the only useful info I get out of the log:
03-21 23:02:22.365: W/MediaPlayer(26062): info/warning (801, 0)
03-21 23:02:22.401: D/MediaPlayer(26062): getMetadata
03-21 23:02:22.416: W/MediaPlayer(26062): Stream has no duration and is therefore not seekable.
03-21 23:02:22.416: E/MediaPlayer(26062): error (-2147483648, 0)
03-21 23:02:22.427: E/MediaPlayer(26062): Error (-2147483648,0)
03-21 23:02:22.443: D/VideoView(26062): Error: -2147483648,0
03-21 23:02:22.446: W/Tag(26062): Playback error in -2147483648 info: 0
03-21 23:02:22.492: W/MediaPlayer(26062): info/warning (3, 0)
Figured it out. I was calling seekTo() with a zero value on a stream with no duration (live stream). Why it worked before, the 5.1 upgrade, I don't know.

Audio input not working using Cordova WebRTC plugin on Android

I'm trying to use the
cordova opentok plugin to create a WebRTC app on my android device. I'm able to send both audio and video from my device using the plugin, but I am only able to receive video. I am getting some errors/warnings that seem to be related the audio problems, but I'm not sure how to debug these:
05-12 14:15:53.142: W/AudioRecord(14619): AUDIO_INPUT_FLAG_FAST denied by client
When I try to run the application on Google Glass, both audio input and output are not working, and I get the following warnings:
05-12 12:58:29.950: W/AudioTrack(26682): AUDIO_OUTPUT_FLAG_FAST denied by client
05-12 12:58:31.192: W/AudioRecord(26682): AUDIO_INPUT_FLAG_FAST denied by client
I'm also getting the following error while streaming:
05-12 13:26:23.702: D/audio_hw_primary(183): select_devices: out_snd_device(0: ) in_snd_device(16: handset-mic)
05-12 13:26:23.702: D/(183): Failed to fetch the lookup information of the device 00000004
05-12 13:26:23.702: E/ACDB-LOADER(183): Error: ACDB AudProc vol returned = -19
I've searched these errors and haven't come up with anything useful for debugging this problem. Any suggestions on how to debug these, or where to go from here? Thanks.

Youtube javascript api iframe playback on android - no Audio

This issue is only on youtube iframe playback on ( 4.3/4.4 on Nexus 7). I go to any media site embedding YT player in an Iframe and the sound does not play. The player will launch and will show controls but, no sound. The logcat msg is :
I/OMXClient( 3004): Using client-side OMX mux.
E/OMX-VDEC-1080P( 180): Extension: OMX.google.android.index.storeMetaDataInBuffers not implemented
E/OMXNodeInstance( 180): OMX_GetExtensionIndex OMX.google.android.index.storeMetaDataInBuffers failed
E/ACodec ( 3004): [OMX.qcom.video.decoder.avc] storeMetaDataInBuffers failed w/ err -2147483648
...
I/OMXClient( 3004): Using client-side OMX mux.
E/OMXMaster( 3004): A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
I/SoftAAC2( 3004): Reconfiguring decoder: 0->44100 Hz, 0->2 channels
D/audio_hw_primary( 180): select_devices: out_snd_device(2: speaker) in_snd_device(0: )
D/ACDB-LOADER( 180): ACDB -> send_afe_cal
jsfiddle to reproduce the bug or just go to any media portal that embeds Youtube clips... this link is fine on my laptop and my phone. Its just the N7 where i've seen bug.
Workaround - use Chrome Beta as browser. But that does not really work if focus is on media heavy environment adapted for tablets.
My question: is it a Chrome problem or just a nexus 7 problem?
--EDIT
sample iframe from 'the dish' that has the issue:
<iframe class="youtube-player" type="text/html" src="http://www.youtube.com/embed/MYrY8aFCUCQ?version=3&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent" frameborder="0" id="fitvid994988"></iframe>

Android RTSP - MediaPlayer init failure / PVMFFailure

I have a camera by Cisco and like to stream it's video stream to my android phone.
It's coded in MPEG4 so there should be no problem, but it's not working anymore (it worked with another camera a few weeks ago). Any idea what I might try ? I don't know what's wrong here.
I/ActivityManager( 79): Starting activity: Intent { cmp=com.Projekt1/.CameraView }
I/System.out(18792): SDPURL - rtsp://10.42.0.103:554/live.sdp
I/NotificationService( 79): enqueueToast pkg=com.Projekt1 callback=android.app.ITransientNotification$Stub$Proxy#44a22218 duration=0
D/MediaPlayer(18792): Couldn't open file on client side, trying server side
I/ActivityManager( 79): Displayed activity com.Projekt1/.CameraView: 270 ms (total 270 ms)
W/MediaPlayer(18792): info/warning (1, 26)
I/MediaPlayer(18792): Info (1,26)
E/PlayerDriver( 52): Command PLAYER_INIT completed with an error or info PVMFFailure
E/MediaPlayer(18792): error (1, -1)
E/MediaPlayer(18792): Error (1,-1)
D/VideoView(18792): Error: 1,-1
W/PlayerDriver( 52): PVMFInfoErrorHandlingComplete
Sorry Nils you have the right codec but Android supports only .3gp Streaming for video, i see you have
rtsp://10.42.0.103:554/live.sdp

Categories

Resources