Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Opening local file in media player with android intent

$
0
0

Hi Everyone,

Can someone help me with opening local file in media player with android intent.

See my code below i have tried lots of different combinations with no luck yet.

Ti.API.xml

<android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="android.intent.category.LAUNCHER"/>
             </intent-filter>
             <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <data android:type="audio/*" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <application android:theme="@style/Theme.Aheme"/>
            <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/>
        </manifest>
    </android>
var intent = Ti.Android.createIntent({
            action : Ti.Android.ACTION_VIEW,
            type : "audio/*",
            url : model.url.nativePath
        });
        //intent.putExtraUri(Titanium.Android.EXTRA_STREAM, model.url.nativePath);
        intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
        //Titanium.Android.currentActivity.startActivity(Titanium.Android.createIntentChooser(intent, 'Play Audio With'));
        Ti.Android.currentActivity.startActivity(intent);

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>