playback

Trouble playing wav in Java

巧了我就是萌 提交于 2019-11-27 01:22:53
I'm trying to play a PCM_UNSIGNED 11025.0 Hz, 8 bit, mono, 1 bytes/frame file as described here (1) and here(2) . The first approach works, but I don't want to depend on sun.* stuff. The second results in just some leading frames being played, that sounds more like a click. Can't be an IO issue as I'm playing from a ByteArrayInputStream. Plz share your ideas on why might this happen. TIA. McDowell I'm not sure why the second approach you linked to starts another thread; I believe the audio will be played in its own thread anyway. Is the problem that your application finishes before the clip

playback video full screen

不羁的心 提交于 2019-11-26 22:12:17
I am trying to play a video in my app. It has to be embedded. I went through the "Play Video Files in Android" thread. I am able to play my video using VideoView as mentioned in this discussion. But there are a few problems. I need full screen video, how do I stretch VideoView to full screen? Will that stretch the video too? I don't need the default play/forward/stop buttons at all. Basically I need continuous loop playing of the video. I tried the MediaPlayer class as in here , but it never worked. What should the string format look like if I have my video file in res/raw directory? I really

How to record and playback with NAudio using AsioOut

丶灬走出姿态 提交于 2019-11-26 21:45:35
问题 I'm trying to get the sound input and send output directly with less latency possible with C#. I'm using the library NAudio that supports ASIO for better latency. In particular, I use the AsioOut object for recording and another for playback initialized with a BufferedWaveProvider , which is filled in a Callback function: OnAudioAvailable , which allows me to use the ASIO buffers. The problem is that I hear the sound with various glitches and with a bit of delay . I think the problem is in

MediaPlayer stop playing after about 5 seconds

和自甴很熟 提交于 2019-11-26 20:57:54
问题 I'm currently developing a simple game and now it's time to add music and sound effect. I tried using MediaPlayer , just like described here: Android media player bug However I have another problem, the MediaPlayer stop playing the music after about 5 seconds. What is probable causing this? 回答1: I had this problem too. It was probably due to having the MediaPlayer-object only existing within a method. For example: //ERROR, stops after 5 sec! public static void playMusic(int id) { MediaPlayer

Playing a video file from a server in Swift

一个人想着一个人 提交于 2019-11-26 18:54:52
问题 I'm trying to play a video from a server using Swift. I have imported MediaPlayer framework, here is my code: import UIKit import MediaPlayer class VideoViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() var url:NSURL = NSURL(string: "http://jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v") var moviePlayer = MPMoviePlayerController(contentURL: url) moviePlayer.view.frame = CGRect(x: 20, y: 100, width: 200, height: 150) self.view.addSubview(moviePlayer.view)

Play two sounds simultaneusly

↘锁芯ラ 提交于 2019-11-26 18:52:16
Is there a way to play two sounds at the same time? I know that SoundPlayer isn't able to do this. I can't use SoundEffect as I believe it's only part of XNA. The two required sounds will be called at unknown and random times. The sound needs to be be controlled after it is played. i.e., the sound must be able to be stopped before it has finished playing. Reference PresentationCore and WindowsBase and try this... var p1 = new System.Windows.Media.MediaPlayer(); p1.Open(new System.Uri(@"C:\windows\media\tada.wav")); p1.Play(); // this sleep is here just so you can distinguish the two sounds

How to load and play a video in pygame

落爺英雄遲暮 提交于 2019-11-26 18:29:36
问题 I'm having a problem. I want to load and play a video in pygame but it doesn't start. The only thing that I am seeing is a black screen. Here is my code: import pygame from pygame import display,movie pygame.init() screen = pygame.display.set_mode((1024, 768)) background = pygame.Surface((1024, 768)) screen.blit(background, (0, 0)) pygame.display.update() movie = pygame.movie.Movie('C:\Python27\1.mpg') mrect = pygame.Rect(0,0,140,113) movie.set_display(screen, mrect.move(65, 150)) movie.set

How do you play a long AudioClip?

巧了我就是萌 提交于 2019-11-26 17:55:02
I have written a simple class to play audio files in a simple game. It works fine for small sounds like a gunshot or explosion, but when I tried to use it for background music I got this error: 'Failed to allocate clip data: Requested buffer too large.' I am assuming this means that the file is too large, but how can I get around this? Source: import java.io.File; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; public class Sound{ private Clip clip; public Sound(String filepath){ System.out.println(filepath); File file = new

MediaPlayer stutters at start of mp3 playback

99封情书 提交于 2019-11-26 15:45:20
I've been having a problem playing an mp3 file stored in a raw resource: when the file first starts playing, it generates perhaps a quarter of a second of sound and then restarts. (I know that this is basically a duplicate of the problem described here , but the solution offered there hasn't worked for me.) I have tried several things and have made some progress on the problem, but it isn't totally fixed. Here's how I'm setting up to play a file: mPlayer.reset(); try { AssetFileDescriptor afd = getResources().openRawResourceFd(mAudioId); if (afd == null) { Toast.makeText(mOwner, "Could not

How to play YouTube video in my Android application?

牧云@^-^@ 提交于 2019-11-26 12:49:45
How do I play YouTube videos in my application? I want to play video by streaming it directly from YouTube without downloading. Also, while playing videos, I want provide menu options. I don't want to play video using default intent. How can I do this? This is the btn click event btnvideo.setOnClickListener(new OnClickListener() { public void onClick(View v) { startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.youtube.com/watch?v=Hxy8BZGQ5Jo"))); Log.i("Video", "Video Playing...."); } }); this type it opened in another page with the youtube where u can show your video Check out