I have code like this:
setContentView(R.layout.webview);
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://www.youtube.com/watch?v=_Z5-P9v3F8w");
It'll show the youtube video with the Play button, but none of the Glass gesture can make the video play. Any ideas? Thanks!
Finally figured out how to play Youtube video on Glass!
Intent i = new Intent();
i.setAction("com.google.glass.action.VIDEOPLAYER");
i.putExtra("video_url", "https://m.youtube.com/watch?v=5bWSgFnoCOk");
startActivity(i);
Using WebView can't play the video, using VideoView can only play local MP4 or streaming MP4 (there's some way to hack the MP4 link for a Youtube video, but not reliable). Also, using VideoView can only pause/play the video, but not fast forward or backward. Using the com.google.glass.action.VIDEOPLAYER above solves all the problems WebView and VideoView have.
Related
I have a silent movie (No sound at all in that clip) which acts as a background movie for my view.
When I play music with iPod and then open my app the iPod music stops.
I don´t want my movie to interrupt the iPod Audio. I´ve read that UseApplicationAudioSession is deprecated but how do I realize this now?
Thank you for your help!
EDIT: And because I add an image onto the MovieplayerViewController I can not use AVPlayer.
PS: Other threads I´ve found here do mention the deprecated UseApplicationAudioSession solution thats why I opened a new question.
Thanks :)
Here is my solution:
AVAudioSession audioSession = AVAudioSession.SharedInstance();
NSError audioSessionError = new NSError();
audioSession.SetCategory(new NSString("AVAudioSessionCategoryAmbient"), out audioSessionError);
I'm playing YouTube videos in my app - the app is Portrait only except that I'd like to have the videos play Landscape. I'm using the much publicized WebView method:
public YouTubeViewer(string url, RectangleF frame)
{
string youTubeVideoHTML = #"<object width=""{1}"" height=""{2}""><param name=""movie""
value=""{0}""></param><embed
src=""{0}"" type=""application/x-shockwave-flash""
width=""{1}"" height=""{2}""</embed></object>";
string html = string.Format(youTubeVideoHTML, url, frame.Size.Width, frame.Size.Height);
this.LoadHtmlString(html, null);
this.Frame = frame;
}
This works great except that the MoviePlayer is in Portrait orientation only. I've tried calling the WebView from within a new ViewController that supports ALL orientations, but it has no effect. I've tried rotating the WebView, but that does not affect the MoviePlayer that is magically called by the iOS.
Any help would be much appreciated.
Thanks,
Rick
The app info.plist was set to only allow Portrait orientation. Changed that and the YouTube controller correctly rotates the MoviePlayer!
I am implementing a Music related Application. In my application I need to use AVPlayer instead of MPMusicPlayer to play iPod Library songs. I used AVPlayer to support FadeIn and Fadeout effects for the background playback of MPMediaItems. I used MPMediaItemProperyAssetURL to get the url from the MPMediaItem and give it as input to the AVPlayer like follows. My problem is some items are won't play because of null url. I found that songs downloaded from iTunes store (which are DRM protected) were unable to play because they have no MPMediaItemProperyAssetURL. Could you please guys help me, how can I resolve these issues. I need to support these DRM protected songs in AVPlayer. Please take a look at my following code for reference,
MPMediaItem *currentItem = [songs objectAtIndex:songIndex];
NSURL *itemURL = [currentItem valueForProperty:MPMediaItemPropertyAssetURL];
currentlyPlayingItem=[itemURL absoluteString];
avPlayer = [[AVPlayer alloc] initWithURL:itemURL];
[avPlayer play];
Thanks in Advance,
Sekhar.
Regrettably there is no mechanism to load DRM'd files into the AVPlayer or any of the AV Foundation APIs. If you can convince your users to upgrade their entire library at $0.30 per song with iTunes Plus, that is the only way.
Ever since I updated to iOS 5, I can't get MPMoviePlayerViewController to play audio on the iPad. Video is perfect, but no audio is heard. It doesn't matter what format I use. It does not work. It works in the simulator, but not on the iPad.
- (IBAction)playVideo {
NSString *filepath = [[NSBundle mainBundle] pathForResource:#"test" ofType:#"m4v"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[[NSNotificationCenter defaultCenter]
addObserver:self selector:#selector(movieFinishedPlaying:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[moviePlayer moviePlayer]];
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
}
Anyone else have this problem? Or found a fix?
It sounds silly, but we came across an issue on my team where the volume control for general iPad sounds was muted and this meant that there was no sound for video played in our app, even though music played through the music player or video on websites worked fine.
To check this volume control you can bring up the task manager (double-tap the home button) and then swipe across to the far left and there are some music controls; check that the mute button on this screen is not on.
try this:
...
moviePlayer.useApplicationAudioSession = NO;
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
set audio session before allocating MPMoviePlayerController will play sound along with video
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:nil];
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
Ensure the audio format in the video file is something that the iPad can play. I believe the simulator has access to the host machine's codecs, which might explain why the iPad can play the video but not the audio. As noted on this page in the MPMoviePlayerController documentation:
If you use this class to play audio files, it displays a white screen with a QuickTime logo while the audio plays. For audio files, this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.
I just made the slide button on the side into lock screen. Then the sound suddely worked.
I want to play an audio compressed with G729. How can I handle codes in J2ME player?
Player p = Manager.createPlayer(url);
p.realize();
where and what I put here to mention about G729.? Any explanation with a sample code please.
I looked here as well.but couldn't find a good solution.