media-player

Using Viewpager with MediaPlayer

左心房为你撑大大i 提交于 2019-12-11 12:19:23
问题 I'm trying to use a viewpager with a mediaplayer and i'm running into some issues. My app is set up where you click on a video in the gridview and then when the screen becomes visable it will start playing the video. When I first open up the video it plays fine. The viewpager works for two pages to the left or right. However when I go over that the app freezes up and crashes. I set up some logs and I found in my pageradapater class, right after setPrimaryItem is called there is an

unable to play sound using android MediaPlayer in dialog?

北战南征 提交于 2019-12-11 12:04:00
问题 I'm trying to play sound in a dialog. But somehow, it doesnt work. I'm not sure whether it's because its in a dialog or so. File file = new File(Environment.getExternalStorageDirectory(),"/record"); final String soundUri = file.getAbsolutePath() + "/" +childName; RelativeLayout layout = new RelativeLayout(MLT_File.this); final MediaPlayer mp = MediaPlayer.create(MLT_File.this, Uri.parse(soundUri)); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT

Azure media Services player

左心房为你撑大大i 提交于 2019-12-11 11:07:24
问题 I'm feeling that this is a really dumb question, but my research tells me I have to create my own player. Is that true? I have a link (publish URL) from Azure Media services like this: http://streamvideotest.streaming.mediaservices.windows.net/4ed49a08-f82d-462e-a05e-acea910064a5/7g91d5d8-b213-406c-90d8-75a3a5e2456d.ism/Manifest Which I would like to hand out to a few people to play the video, or live feed at that channel. But you need some type of player? I've tried Windows Media Player

How to maintain aspect-ratio when playing RTSP streaming video in Android?

≡放荡痞女 提交于 2019-12-11 11:03:11
问题 I have a streaming RTSP video link which I am playing with the help of VideoView. In the portrait mode the Video resolution and aspect ratio is perfect. But when I try switching to the landscape mode the video stretches and looks elongated. This distorts the quality to a great deal. Any tips of how to make the videoview to maintain the same aspect ratio in both orientation modes? If i need to write my own media player extending the VideoView .. How exactly should I override the onMeasure(...)

Android MediaPlayer on ViewPager blocking UI transition and no callback for initial page loads

坚强是说给别人听的谎言 提交于 2019-12-11 10:01:08
问题 Basically, we want to build a paged horizontal scroll view with one video player on each page; Video should auto-play and auto-pause/stop when page focus is changed. So I decided to use a ViewPager to show video Fragments. Each fragment has its own SurfaceView and MediaPlayer for video playing. The goal is to auto-play video when initial page loads and when user swipes to select a new page. I am facing a few issues: I couldn't get callback from ViewPager when initial page is loaded. I’ve try

How to programmatically crossfade between songs

不想你离开。 提交于 2019-12-11 09:44:52
问题 I am working on a music player for the iPhone, and I would like to crossfade between songs. I know this is possible because My DJ does it...I can't find any documentation and don't even know where to begin on it. Can anyone give me a starting point or example code? Thanks. 回答1: One option is to convert both songs into raw (linear PCM) samples. Then build your own mixer function or audio unit where the mix ratio of each sample comes from a ramp or custom mix curve function. Feed the output to

How to play video and audio from separate URLs in UWP app?

坚强是说给别人听的谎言 提交于 2019-12-11 08:53:30
问题 I'm trying to create a video player for a UWP Desktop App. I not able to play a video and audio from different URLs. I have given my code below but I haven't given audio and video URLs. I'm using a Xampp local server for my case. Please Help Me. My MainPage.xaml.cs : namespace my_video_player { public sealed partial class MainPage : Page { MediaPlayer video_player; MediaSource mediaSource_video; MediaSource mediaSource_audio; public MainPage() { this.InitializeComponent(); video_player = new

ASP.NET MVC Audio Streaming

穿精又带淫゛_ 提交于 2019-12-11 07:55:13
问题 I'm developing a web app that streams music tracks from a server to multiple clients. We are using MVC3 to build the application. I'm looking for an open source library or relatively simple custom solution that works well with MVC that we could use to stream the music to each client. All of the developers I'm working with are still fairly new to MVC, so we're kind of at a loss where to start with the streaming aspect of the app. One more thing, synchronization is an issue because every client

Play music from memory in Android

妖精的绣舞 提交于 2019-12-11 07:41:41
问题 Is there a way to play a song that exists as an array of bytes in memory and not as a file on disk? I know I could save it in a file temporarily and play it form there but I'd like to avoid this as I'm trying to implement a DRM system that will not expose unencrypted media files. 回答1: You can use AudioTrack. But it supports raw LPCM data only. 来源: https://stackoverflow.com/questions/6425778/play-music-from-memory-in-android

Android MediaPlayer gives null exception

六眼飞鱼酱① 提交于 2019-12-11 07:38:55
问题 Can someone help me with this strange issue, I want to play an audio file from SDCard , this is the code,I know that this is the right file path, but MediaPlayer gives me a null exception. Any help will be appreciated! File file = new File(android.os.Environment.getExternalStorageDirectory()+"/rockstar.mp3"); MediaPlayer m = MediaPlayer.create(getApplicationContext(), Uri.fromFile(file)); m.start(); This is stacktarce java.lang.NullPointerException 回答1: Are you not missing .getAbsolutePath()