Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STREAM AUDIO in master branch #97

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file modified Logotype.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.media.AudioAttributes;
import android.net.Uri;
import android.os.Binder;
import android.os.IBinder;
Expand Down Expand Up @@ -40,6 +41,8 @@ public class JcPlayerService extends Service implements
private List<JcPlayerView.JcPlayerViewStatusListener> jcPlayerStatusListeners;
private JcPlayerView.JcPlayerViewServiceListener notificationListener;
private AssetFileDescriptor assetFileDescriptor = null; // For Asset and Raw file.

private AudioAttributes stream;

public class JcPlayerServiceBinder extends Binder {
public JcPlayerService getService() {
Expand Down Expand Up @@ -153,6 +156,12 @@ public void play(JcAudio jcAudio) {
mediaPlayer = new MediaPlayer();

if (jcAudio.getOrigin() == Origin.URL) {
stream=new AudioAttributes
.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
.build();
mediaPlayer.setAudioAttributes(stream);
mediaPlayer.setDataSource(jcAudio.getPath());
} else if (jcAudio.getOrigin() == Origin.RAW) {
assetFileDescriptor = getApplicationContext().getResources().openRawResourceFd(Integer.parseInt(jcAudio.getPath()));
Expand Down
2 changes: 1 addition & 1 deletion jcplayer/src/main/java/com/example/jean/jcplayer/JcPlayerView.java
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,4 @@ public void registerStatusListener(JcPlayerViewStatusListener statusListener) {
}
}

}
}
Binary file modified jcplayer/src/main/res/drawable/bg_player_white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified jcplayer/src/main/res/drawable/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions jcplayer/src/main/res/layout/view_jcplayer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
android:scrollHorizontally="true"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textSize="18sp"
/>

<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:layout_below="@id/txt_current_music"
>

<TextView
Expand Down
Binary file modified jcplayer/src/main/res/mipmap-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified jcplayer/src/main/res/mipmap-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified jcplayer/src/main/res/mipmap-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified jcplayer/src/main/res/mipmap-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified jcplayer/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/drawable/myicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/mipmap-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/mipmap-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/mipmap-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.