I am using https://github.com/youtube/youtube-ios-player-helper to play videos from youtube in my app.
I am also using different playvars to control what to and what not to show on the player. But the controls section I see on the player is not like iOS.
I tried in other sample app where I could get the proper controls.
NSDictionary *playerVars = #{
#"playsinline" : #1,
#"showinfo":#0,
#"autohide":#1,
#"modestbranding":#1
};
[self.playerView loadWithVideoId:self.videoId playerVars:playerVars];
I played with few other options with these vars but no luck. I am not sure what controls what type of controls are displayed from apps perspective.
Tracked down the issue. It was the custom user agent I was setting for my app, which was causing youtube player to behave differently.
Related
YouTube Helper Library in iOS does not working on certain videoId-'ozUdQJxvQCk'.
https://developers.google.com/youtube/v3/guides/ios_youtube_helper
I followed the guide.
Playing well on other platforms(android, mweb, and in youtube)
[self.playerView loadWithVideoId:#"ozUdQJxvQCk"];
When the video is loaded and the play button is pressed, the following logs are displayed.
Thanks for any help!
I am using "YTPlayerView" to play video in iOS. When I am using this in iPhone it automatically play video in full screen but when I am using same thing in the iPad it does not switch to full screen. I also tried the below parameters but no success.
NSDictionary *playerVars = #{ #"playsinline" : #0 };
[self.playerView loadWithVideoId:videoIDURL playerVars:playerVars];
We have developed a very video intensive app for both iPhone and iPad in the past, and actually had the opposite problem - we wanted to use the YTPlayerView for displaying videos inline (non-fullscreen) on both devices, but weren't able to get it done on the iPhone. We ended up using XCDYouTubeVideoPlayerViewController, which seemed to have resolved most of our issues. This is not really the recommended way to approach this, since it pretty much breaks YouTube's terms of use (it parses the html page, finds the .mp4 url, and plays it in MPMoviePlayer, which gives all all of the flexibility you need for full screen, loading times and other notifications.
Throughout the process of trying to find a way to work with YTPlayerView, I contacted engineers form Google who work on the YouTube helper framework, and they recommended to work directly with the iframe player API, which lets you customize the controls and receive events about the video. This means you'll have to use your own web view instead of the YouTube helper. The communication between the JavaScript and the Objective-C parts can be tricky (and that's what the helper library actually tries to save from the developer), but it will give you more flexibility.
This can also help with working with UIWebView to display YouTube videos: Playing YouTube Videos in a WebView Inline.
I know it's not exactly what you asked, but I hope it can help lead you in the right direction. I've had a lot of issues working with YouTube videos on iOS, so I know how frustrating it can be. Good Luck!
YouTube player update allow vertical video can display fullscreen in vertical mode. I was asked to fit YouTube video in a vertical view (not a full screen mode) in our iOS app.
We use YTPlayerView to playing YouTube video, but it doesn't provide any method to check if a video is vertical. I guess we can query such the info from YouTube web API, but I couldn't find any thing.
Has anyone tried to do the same thing like mine?
If it's not fullscreen mode then:
NSDictionary *playerVars = #{
#"playsinline" : #1,
};
[self.playerView loadWithVideoId:#"VIDEO_ID" playerVars:playerVars];
Just adjust the view's position etc, it will play just fine. Edit the html file they provide so the background matches your app's etc if you don't like the black.
I have a requirement to create custom controls for Youtube player in iOS. I have used UIWebview to play youtube videos. I have hidden default controls by using 'controls':0 flag. I am able to map all the actions like play, pause etc using youtube's java script api with my UIButtons. But, I am not able to figure out how to toggle full screen mode programatically with my custom button.
Any help is appreciated.
I'm developing an iPhone App and I need to implement a player to play a list of media (video/audio) items.
Following is a screenshot of player I have captured from an another iPhone app, I found many apps playing video/audio using a player has similar UI like this.
Can this player (including UI) can be implement by official API? Or just implement manually?
How can I implement a same player like this?
To Play audio follow this blog
And to play video, either you can use CustomMovieplayer or go with UIWebView with embedded html.
Movie Player sample code from here
To play video as embedded html in UIWebView, check this..
https://stackoverflow.com/a/7551375/790794
As per the file type, you can modify the source type.