How to Embed a Youtube Video into My App

How to embed and play a YouTube video in android

The Answer is Simple "YES".

Please look at to following link,

How to play YouTube video in my Android application?

Streaming Youtube Videos

How to embed a Youtube video into my app?

Xcode 8.2 • Swift 3.0.2

import UIKit

class ViewController: UIViewController {
@IBOutlet weak var wv: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
loadYoutube(videoID: "oCm_lnoVf08")
}
func loadYoutube(videoID:String) {
guard
let youtubeURL = URL(string: "https://www.youtube.com/embed/\(videoID)")
else { return }
wv.loadRequest( URLRequest(url: youtubeURL) )
}
}

Xcode 7.3.1 • Swift 2.x

import UIKit

class ViewController: UIViewController {
// create an outlet for your webview
@IBOutlet weak var wv: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// load your you tube video ID
loadYoutube(videoID: "oCm_lnoVf08")
}
func loadYoutube(videoID videoID:String) {
// create a custom youtubeURL with the video ID
guard
let youtubeURL = NSURL(string: "https://www.youtube.com/embed/\(videoID)")
else { return }
// load your web request
wv.loadRequest( NSURLRequest(URL: youtubeURL) )
}
}

Iframes and React.js - How to embed a youtube video into my app

You can just use an iframe element to achieve this. There is no need to depend on yet another npm package.

<iframe src='https://www.youtube.com/embed/E7wJTI-1dvQ'
frameborder='0'
allow='autoplay; encrypted-media'
allowfullscreen
title='video'
/>

By the way, if you are wondering why the embed URL looks like it looks, you can just go to an arbitrary Youtube video, click on Share and then you immediately see that we just need to append /embed/:videoId Youtube's base URL.

Embed YouTube live stream in android app

First video id out-of-date so you need to replace another one and check agein

Also i think your code should be like below

onCreate

YouTubePlayerView youTubePlayerView = findViewById(R.id.youtube_player);
youTubePlayerView.initialize(getString(R.string.google_developer_api_key), this);

OnInitializedListener

@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
youTubePlayer.loadVideo(""); // your video id
youTubePlayer.play();
}

embedding youtube video in iphone app

No need to use the embed code. The standard UIWebView aimed at the youtube web address should work fine...

// URL from safari address bar. 
NSURL *url = [NSURL URLWithString:@"http://www.youtube.com/watch?v=fDXWW5vX-64"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];

How to embed a YouTube clip in a WebView on Android

I am not sure if this is what you need. Anyway I hope the following be useful.
You can use the iframe method that youtube provides to play its videos. If the browser supports html5 will show the video with it, otherwise with flash.

You can use the following code as an example <iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/bIPcobKMB94" frameborder="0">

in the above example the video id is bIPcobKMB94. You can change this id and show your video.

You can access a live example of it here

More infromation for youtube iframe

YouTube HTML5 Video Player



Related Topics



Leave a reply



Submit