Youtube video as texture on Unity3d Android app - android

I'm trying to render Youtube video onto Unity3d texture, through a plugin for Android.
1) Android MediaPlayer API can render video streaming with specific url onto a texture.
But there's no official method to reveal streaming urls for Youtube videos.
2) YoutubePlayerView class in Youtube API lets me ignore how to play Youtube videos,
but there's no way to render any Android View including YoutubePlayerView onto a Unity3d texture.
(I succeeded to render a WebView onto another SurfaceView, but when load Youtube iframe source onto the WebView, video is not rendered to another one; Youtube Player UI components were rendered.)
Is there anyone have some idea to solve? Any kind of workaround will be ok.

I was doing something like this with augmented reality. In my case I used a normal video player which you can play video files in a texture. What i did was use the direct link for the youtube video file (not youtube URL) instead of a local file link and it worked.
So you have to found the link to the youtube video file. It's easy with some libraries that you can find on internet. Also you can develop a web scraper to find it in the youtube URL html but its a more complicated option.

I added YouTube integration to a client's Unity 3D app with this 3D web plugin for Android / iOS. In my case, I just added the prefab to my scene and loaded YouTube like this:
prefab.WebView.LoadUrl("https://youtube.com");
If you want just the video by itself, it looks like you could access it with this VideoTexture property.

Related

load movie trailer in android application from imdb

Is it somehow possible, you can load the movie trailers from imdb to videoView or the native android player.
so far, what i've tried.
Iframe approach which let me load trailer in webview, which is exactly i don't want.
Here i found a link which is something a direct link to stream.
I want this to play in video view or native android control.
thanks in advance.
The link you have above is not a direct link to the video - it is actually a link to a web page which contains an embedded player, which in turn has a link to the actual trailer video itself.
You can see the link the to the video if you use the network timeline tab in a browser inspector to look at the network requests. For your example above the client (the browser running the HTML5 page you have downloaded) is requesting the video m3u8 file with the following request:
http://imdb-video.media-imdb.com/vi1225109529/1421100405014-mxwp62-1434643350557.m3u8
This is the 'index' file for a HLS format video file - it tells the client where to request the video streams. The client then downloads the video chunk by chunk which you can see as requests for TS segments - e.g. for you example above:
http://imdb-video.media-imdb.com/vi1225109529/1421100405014-mxwp62-143464335055700002.ts
If the IMDB site does not protect or restrict the video in some way (for example only allowing it play from their embedded web page) then in theory Android should be able to play a HLS file if you point the Media Player towards the m3u8 file. In practice however Android has well know issues with HLS playback so you may find it problematic - see this summary: http://www.jwplayer.com/blog/the-pain-of-live-streaming-on-android/

Video link of unlisted youtube video

I am developing an android application that streams and shows a couple of videos. Instead of storing videos on my server, I thought uploading them to youtube as unlisted, and getting them from youtube is a great idea. After getting the video, I want to show them in default android video player, not in youtube app or web view.
I don't have any problem when I put videos in my server (for example www.mysite.com/video.mp4), but is there any way to get the url of a youtube video?
You can upload the videos using the YouTube Data API v3:
https://developers.google.com/youtube/v3/docs/videos/insert
And setting the status.privacyStatus as unlisted
Then you can use the YouTube Android Player API to include the Video Player on your own Android App
https://developers.google.com/youtube/android/player/
To play a video, you only need the video ID, not the full url..
eg:
player.loadVideo("wKJ9KzGQq0w");

VideoView or WebView in YouTube Android App

Now this is a really stupid one! Forgive me on this question please but I really don't know the answer to it. My question is What have Youtube used to play videos intheir Android app? I mean is it a WebView or Just a simple VideoView? I used VideoView to play videos from the URL associated with them but it doesn't look as nice as YouTube's VideoView (or whatever it is)
And is there any other option to play videos from a URL other than using the code below? Because it just plays video in the native video player. If the red-marked portion in the image below is a VideoView, how does it look better than the normal VideoView? Or is it a WebView? Which one is a better option (in terms of UI) to play video from a URL? I'm using GingerBread and want to play mp4 or .flv videos in a VideoView or WebView (whichever is the better option, preferably like Android's YouTube app)
Uri data = Uri.parse(movieurl);
intent.setDataAndType(data,"video/3gpp");
startActivity(intent);

Embedded video inside of Android media player

I have an application that I want to play a video in. I want to play the video from an embed code via html5 in an iframe. Is it possible to call the androids stock video player to play the video from the iframe embed code?
I fixed this by putting my embed code in an html file inside the assets folder. works greate.

.mov file will play in browser, but not in native MediaPlayer app

I am launching the MediaPlayer to play a .mov file that is being passed into the MediaPlayer as a Uri (which is standard). However, it is telling me that it cannot play the file. However, if I put this same link on the web, and the click the link to launch the movie (while in my Android browser) the video plays no problem. However, I can't get the WebView to play it with the Video tag despite all my efforts.
So here is my question, what magic is taking place that allows an android browser app to take a .html url which contains a link to play a video and play it? If I load the same url in a WebView, or try to pass the video url into the mediaplayer, it is a no go. The format of the video is .mov.
Thanks in advance to everyone.
The Android browser and WebView are very different, WebView is very barebones as it was designed expecting people to use it for very basic showing html webpages. WebView by default has no plugins enabled, no javascript enabled and so on and so on. Never expect that because something works in the browser that it will work in a WebView.
Now in regards to how the media is handled. The Browser has extra features set up to strip the video source from the page and launch it in the native player most of the time. This functionality is not built into WebView. And the native player is very picky about what needs to passed into it as a URI to be able to play it.
Hope that helps,
Stevy888

Categories

Resources