I am using YTPlayerView for playing embedded videos in my app. Everything works perfect with ID but video doesn't play with URL. Here is my code
-(IBAction)playVideo:(id)sender{
self.playerView.delegate = self;
self.playerView.hidden = false;
[self.playerView loadVideoByURL:#"https://www.youtube.com/watch?v=KWTULSf29Ho" startSeconds:0 suggestedQuality:kYTPlaybackQualitySmall];
}
The URL has to be in the format youtube.com/v/VIDEO_ID?version=3, your url was wrong.
if you want to achieve the specific format, change your method which for responding user input url, appending ?version=3 with user input url.
check this,i think you forgot load the video into the player
Related
I am using the new Apple Music API with MPMusicPlayerController but play method doesn't work in the first time called, but after the second or third time.
My code is the following:
MPMusicPlayerController *appleMusicPlayer = /*access instantiated player*/;
[appleMusicPlayer setQueueWithStoreIDs:#[url]];
[appleMusicPlayer play];
The player is instantiated as follows:
_appleMusicPlayer = [MPMusicPlayerController applicationMusicPlayer];
_appleMusicPlayer.repeatMode = MPMusicRepeatModeNone;
_appleMusicPlayer.shuffleMode = MPMusicShuffleModeOff;
[_appleMusicPlayer beginGeneratingPlaybackNotifications];
The url passed in setQueueWithStoreIDs method is a NSString with a country-specific valid iTunesID. I provide you with a screenshot of NSLog output of url after above play method is called.
Any help would be much appreciated.
Make sure url is a string of the store ID!
You can get that here: https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/
I have this stream url with mp3 type: http://www.slobodnyvysielac.sk/redata/other/play.php?file=informacna%20vojna%20-%202015-02-17%20financne%20skupiny.mp3
when I open this url with Safari or Chrome, it can play, but I can't play it with objectives C code (iOS).
Please tell me the solution!
Thanks all!
player = [[AVPlayer alloc] initWithURL:[NSURL URLWithString:#"http://archive.slobodnyvysielac.sk/informacna%20vojna%20-%202015-02-10%20hudo.mp3"]];
[player play];
Inside your view controller or whatever class you have define this, don't define it inside the event where you stream.
AVPlayer *player
EDIT:
There was a problem with your URL, if you open it in the browser, it opens a flash player so I inspected the flash object and got the original MP3 url which will stream, and you can compare how Google Chrome e.g. reacts to both URLs to notice the difference, now the url in my above code is the correct one
I have used PrimeFaces for playing a youtube video from url.But there is a problem in this tag.Some of the youtube links are playing but some of them are not playing.For example;
this video is playing but this video is not playing.Here is the code;
< p : media value = "http://www.youtube.com/watch?v=mqOo7cYCBAo" width="600"
height="400"
player="flash"/>
you need to check the link. The video link which it plays has some modifications. Its not exactly the same as the one you're trying to play.
https://www.youtube.com/v/KZnUr8lcqjo
https://www.youtube.com/watch?v=mqOo7cYCBAo
Observe the strings after .com
You need to replace the string in proper format to make it play.
I'm developing an HTML5 audio player for use specifically on iPhones, and am trying to get an EQ visualizer working. From what I've found there are two ways to set this up:
One where you load the mp3 file on demand using an XMLHttpRequest:
var request = new XMLHttpRequest();
request.open('GET', 'sampler.mp3', true);
request.responseType = 'arraybuffer';
request.addEventListener('load', bufferSound, false);
request.send();
function bufferSound(event) {
var request = event.target;
var buffer = myAudioContext.createBuffer(request.response, false);
source = myAudioContext.createBufferSource();
source.buffer = buffer;
}
You then use the source.noteOn and source.noteOff functions to play and pause the audio. Working this way, I AM able to get the EQ visualization going. BUT, you have to wait until the mp3 file completely loads to start playing, which won't work in our situation.
The other way to do this is to have an <audio> element already on the page, and you get the audio data from that using:
source = myAudioContext.createMediaElementSource(document.querySelector('audio'));
You then use the audio tag's play and pause functions. This solves the loading problem as it allows the media to be played immediately once the page loads... BUT, EQ visualization is gone.
Both methods show the EQ when testing on Chrome (WIN), so there seems to be something specific with iOS/iPhone that isn't allowing me to get the data from an <audio> tag, but will allow me to get it if I load the mp3 file on demand.
...
Any ideas out there?
Unfortunately Safari doesn't properly support MediaElementSource. It's a bug: Why aren't Safari or Firefox able to process audio data from MediaElementSource?
Does anyone know how to play a facebook video in a UIWebView?
My app uploads video to facebook and retrieves the video's url. I'd like to embed this url into a UIWebView to play back. I've worked this out for youtube but not Facebook. looking for help.
Orpheus!
I’m a few years late lol, but I’ll post the answer here anyway -- in Swift since it’s 2018 ;) -- just in case someone needs it.
You can use the following HTML string:
let embedCode = "<iframe src=\"https://www.facebook.com/plugins/video.php?href=\([INSERT VIDEO URL])&show_text=0&width=\(Int([INSERT WIDTH]))\" width=\"\(Int([INSERT WIDTH]))\" height=\"\(Int([INSERT WIDTH] * 56.25))\" style=\"border:none;overflow:hidden\" scrolling=\”no\" frameborder=\"0\" allowTransparency=\”true\" allowFullScreen=\"true\"></iframe>"
where you replace [INSERT VIDEO URL] with the video URL and [INSERT WIDTH] with the desired web view width.
Then load the HTML into the UIWebView like so:
webView.loadHTMLString(embedCode, baseURL: nil)