how to play private channel video of youtube in iOS App [duplicate] - iphone

How I can integrate Youtube with iOS? Mainly I want to play private videos without asking for login. Login should be hard coded in the app and will not ask user before playing the private video.

Some YouTube videos can be played back in a MPMoviePlayerController - some cannot. When you query a video through the YouTube Data API https://developers.google.com/youtube/2.0/reference#Videos_feed
you'll get back all the content types available for a particular videos, including the Flash player, 3GPP, MP4 (if available), etc. You can use these URLs to load up a MPMoviePlayerController.
This is perfectly fine, but as I've said - not all videos are available to embed this way. Some videos (mainly ones that require adverts to be displayed) can't be put into native controllers.

Related

How to play vimeo videos inline in moblie application and grab seek, play events

We are developing a mobile application (using ionic framework, jquery) and thinking to let our users to share videos from vimeo, youtube etc. in this case we are integrating vimeo video link in iframe. Below are challenges:
Not able to play vimeo videos inline in our application:
on iPhone device when we play vimeo video from our ionic application it opens in a native video player, on the contrary we want to play it inline in our application itself
in case of Youtube video its supported and works well. They have provide Playsinline property to support it.
As per vimeo developers documentation, we have not found any similar video player property to allow inline video rendering
Is there any workaround that you suggest to play vimeo video inline inside application?
Play, seek & load progress events are not supported in mobile application
As per your developers page, play, seek, load progress etc events are not supported in mobile application
Is there any workaround to enable these events on our mobile application
Yes, I know there are limitations that vimeo has declared but can someone provide me if there are any workarounds? Your response to our queries is very much important for us.
Reference:
https://developers.google.com/youtube/player_parameters
https://developer.vimeo.com/player/js-api#event-compatibility
try adding background=1 to your embed code
<iframe id="player1" src="https://player.vimeo.com/video/[video id]?api=1&player_id=player1&background=1" width="630" height="354" frameborder="0"></iframe>
This wil not work in browsers which revert to the flashplayer.
I don't know if you'll have javascript API functionallity.
This will remove all controls aswell. What I've read, it's still in an experimental fase, but hope it works for you.

Youtube API for IOS (search functionality)

I want the users of my app to be able to search videos on youtube and play whatever they may choose.However, all the open source code I've seen requires the video identifier to stream it. Is there a way I can use the youtube search engine to browse and play videos?

Playing video from youtube link without UIWebView

I want to play a video in my app from youtube link e.g: http://www.youtube.com/watch?v=Uner-3tTY1I.
But i don't want to redirect the user to any web view in the app. Just want to play that video in the video player in the current view of my application.
Is it possible to play the video without redirecting to UIWebView? If possible, how can i do this? Thanks for the help in advance.
The only allowed way seems to be using UIWebview. Doing it other way will violate youtube copyrights.
However there are few open source libraries out there. You can use it at your own risk.
Just use XCDYouTubeVideoPlayerViewController. It uses progressive download + MoviePlayer and AVFoundation frameworks.
To play this video you need to have the link to the video stream that is associated with video you want to play. Unfortunately this isn't so simple to get this link for some movies on YouTube since this link can be encoded for some movies (channel VEVO for example). Read this for more information about encoded links http://www.jwz.org/blog/2013/06/youtube-download-counter-countermeasures-applied/.
Unfortunattely as for now there is no simple way to decode these links. Despite this, you can get the source link for the not encoded films without bigger problems using some calls to the YouTube Api.

Can a iOS app load a webview with youtube?

I am developing an iOS app. In that I am loading couple of youtube videos using HTML5 using webview.
I am bit concerned about the fact that apple will reject the apps that are loading some big videos directly without HTTP live streaming.
So, is my approach wrong? Shall I load youtube video directly? Is the youtube providing HTTP livestreaming by itself?
I am curious to know these stuffs.
Thanks.
It's fine to load the YouTube video in HTML WebViews. Many apps do it this way.
The key thing to remember is that you are not allowed to autoplay videos, they have to be user initiated i.e. they have to press the play button.
Edit:
Please check this official page

Can we play only audio using youtube api for iPhone

In my project i have to use youtube api and play only audio of the video. We must not show the youtube player. Is it possible to play only audio without showing video using youtube api?
Extraction may be the incorrect implied word here. From what I understand, is user133611 wants to have an audio only stream from YouTube. Unfortunately, YouTube directly forbids it. Here is a quote from Kuan Yong from the YouTube API team:
Your API Client will not, and You will not encourage or create
functionality for Your users or other third parties to:
"separate, isolate, or modify the audio or video components of any YouTube audiovisual content made available through the YouTube API"
-Kuan Yong, YouTube API Team
Link reference: https://groups.google.com/group/youtube-api-gdata/browse_thread/thread/7fac8e8ff913b6c4?pli=1
I don't think this is really possible only using Youtube API. The Youtube API is not intended to be used for "downloading" videos/audio from them. You should go here, to understand what the Youtube API is really about.
A small abstract:
Unless I am missing something really big, the Youtube API consists of 5 main parts:
Data API
Custom Player
YouTube Direct
Player APIs
Widgets
None of this APIs allow you to for example "download" a video. Also I think (correct me if I'm wrong), that in a youtube video, the audio is actually embedded in the flash video, making the task even less trivial.
To illustrate you, the Data API, allows you to perform and use the youtube video search capabilities, use playlist capabilities and many more of the operations available on the YouTube website.
That have being said, the Youtube API, can be used for example to upload a video from your iPhone to youtube, as this example illustrates.
My Thoughts:
I think that extracting the audio from a youtube video, is actually possible, but involves a whole different process of downloading the video in H264 and then extracting the audio... but it still involves downloading the whole video.
Is the audio only prohibition still valid? Streamus is available as a Chrome Extension. It streams audio only from YT - see website https://streamus.com/
Well, one can simply give the video a width and height of 1px, or better yet do:
.video { text-indent: -9999px; }
And then force the video to play via the API controls. But I wouldn't do it as it is against their TOS and would result in my app being blocked if they find out.
I really confused about your platform. Do you want to do it over iOS platform with writing native code? If yes, you can do it without playing video. But you have to stream both video and music. You can do it with AVAudioPlayer Class, check the reference from
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/
But yes, you will makes users GSM data overload and it's not fair with letting users about that situation.
Maybe you can force your view over the youtube view? Have you tried that?
If it is against TOS, the op should just drop the idea of implementing his idea.
Just imagine the free music everyone will be streaming out of the promo videos of major videos on youtube!