wayout to play audio in android app without Java code - android

I am planning to create a music app which allows user to choose from a number of inbuilt audio. The closest thing I found on the web was jPlayer plugin for jQuery which I couldn't make it work on Android. My app is based on jQuery mobile.
Is there any really simple way to add audio to my web app which I am planning to convert to .apk using phonegap. I intend to provide a list of links/file names to user in my app and on clicking the file name/link, the audio player controls shall be displayed and the selected audio shall start playing.
I have also tried the HTML embed tag and it also didn't work in the apk.

PhoneGap doesn't support the tag yet as far as I know.
I have heard of people successfully using the PhoneGap API +jQuery Mobile to get it working via this tutorial: http://www.mobiledevelopersolutions.com/home/start/twominutetutorials/tmt1part1

Looks like you can use a PhoneGap plugin to do this:
window.plugins.webintent.startActivity({
action: WebIntent.ACTION_VIEW,
url: 'http"//whatever.mp4'},
function() {console.log('Wow this actually worked!');},
function() {console.log('Failed to open URL via Android Intent');}
);
https://groups.google.com/forum/?fromgroups=#!topic/phonegap/nEm47r1Bhak

Related

Audio on Mobile apps

I am new to apps development, so I apologize if I am asking something which may seem simple.
I am building a hybrid application using ionic. Everything was smooth until I tried to play audio. I am trying to play an HLS audio stream and some mp3 files located on a web server.
After a research on the internet and various tests using players, I used the video.js. After some tests I figured out, that the player was not responding to android versions prior to 4.4.2. ...and I haven't yet made any test on IOS.
I am realy confused on how I can play audio on a hybrid mobile application.
Any help is much appreciated!
The audio feature in Ionic Framework can be implemented by using the Apache Cordova Media plugin, and ngCordova.
Install the plugin by running the following ,
cordova plugin add org.apache.cordova.media
1.Play audio file from internet
html
<button class="button" ng-click="play('http://www.stephaniequinn.com/Music/Commercial%20DEMO%20-%2013.mp3')">Play from internet</button>
1.play a song from the file system
html
<button class="button" ng-click="play('www/mp3/song.mp3')">Play from file system</button>
controller
$scope.play = function(src) {
var media = new Media(src, null, null, mediaStatusCallback);
$cordovaMedia.play(media);
}
it will try to play song from /storage/emulated/0/www/mp3/song.mp3
Please refer this blog.You will get more idea.If you have any doubt,please let me know,thanks
If you're playing audio and it is essential to your app, you should think about programming an audio service (in Java). When the user navigates to another app and the system is under heavy load, the use of an audio service prevents the OS from killing your audio along with your activities.
Also, when audio playback gets into the app, you must make sure that the playback stops when a phone call arrives or the app loses the audio focus. I don't know, whether or not you can handle all of this with ionic and I also don't know your coding skills. But handling audio on Android can quickly become a very complex task. Hence I recommend a separate service, that works as an encapsulated component.

Cordova Plugin to display audio information and controls on iOS and Android Lockscreen

I am looking for a plugin or plugins that would allow me to show audio metadata (Title, Artwork etc.) on the Lockscreen of both iOS and Android.
Along with that I would like to control the audio from the lockscreen (Play pause etc, it already happens in iOS I need it happen on Android).
Lastly the plugin should provide audio information within the control center in iOS and the notification area in Android of cause with the ability to Play Pause etc.
If it is easier to do with some native code tweaks then can someone please point that out also to a tutorial as to how it can be done.
Below are some examples of what I am speaking about
This plugin does what you're looking for: https://github.com/homerours/cordova-music-controls-plugin
As of writing it has a few issues with iOS html5 audio (see https://github.com/homerours/cordova-music-controls-plugin/issues/97 and https://github.com/homerours/cordova-music-controls-plugin/issues/66) but works across iOS, android and windows phone.
You could also try this, however I have never tried it. It uses the native players for iOS and Android, and will not work on chrome or your dev machine.
https://github.com/wnyc/cordova-plugin-playerhater
On my current project I have much the same need as you, (I am using HTML5 audio) and have had to put together a number of different plugins.
iOS Background Audio
https://github.com/AubreyHewes/cordova-background-audio
iOS Meta data:
https://github.com/ChoiZ/NowPlaying
https://github.com/shi11/RemoteControls
I am working on a solution for a modular android audio notification controls using the webintent plugin, but I am far from finishing it. I'll post back here when it's done.

Voice recordering in Android web view app using Cordova

I am trying to open my web page as Android app. I want to add voice recording functionality using phone microphone in my web app. When a link on web app page is clicked it should start recording and save the recorded file.
After searching its possibility, i came up with "Cordova". But still not able to make it.
Thanks in advance.
I've got a solution for this issue. Web page can be opened in an iFrame and then it can communicate with the app.
Refer example below for using Camera of the device.
[http://hackerluddite.wordpress.com/2012/04/15/getting-access-to-a-phones-camera-from-a-web-page/][1]
It works...:)

Use the iframe api (youtube) with Cordova for android

After a good two hours of searching the Internet I can't find a solution to my problem.
I'm trying to develop an application for android and iOs using Cordova. In this application I make use of the Iframe API of Youtube. I need to be aware of the end of a certain video in order to call another one.
But it seems that this API is not working on Android (but well on iOs). Does anyone has a solution for this ?
Here is what I've thought of:
Basic embedding of a Youtube (without the API) and a custom listener to be notified of the end of a song (No idea how to do that...)
Use a Cordova plugin for the android youtube api (the one I saw only had the possibility to load a song not having listeners)

How can I open a YouTube link with youtube app in Android (using Dreamweaver CS6)?

I'm using adobe dreamweaver CS6 and jQuery Mobile to develop Android applications. After developing, my apps are put together by phonegap. Here I have the following problem: I have some buttons related to YouTube links, but I want them to open in the YouTube app. I'd like to work only in Dreamweaver, and use plug-ins only if necessary. I've already read about "intents" and "URL-s", but I don't know how to use them and how they work in dreamweaver. I haven't found any good tutorials on it yet.
Please be detailed if you can.
Normally you can simply link to youtube. The youtube app will handle the request and will start if the user allows that.
The youtube app has a special intent handler where the urls to youtube will be catched. So normally on the first link to youtube the user will be asked if the youtube app should be started or the browser(s).
Such a link what works in a native android application would be: http://www.youtube.com/watch?v=xxxx
So in dreamweaver/html it should look like this:
Some Video

Categories

Resources