Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8467109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:32:49+00:00 2026-06-10T15:32:49+00:00

I am working on one app where I am giving functionality to user to

  • 0

I am working on one app where I am giving functionality to user to play Youtube video saved in database. And if user wants, he can update the video.

Say I have saved a link like http://www.youtube.com/watch?v=1Ziku4FLka4 in DB and I am playing the same link on a button click for which I have implemented code like below :

   UIWebView *wv;

strUTube = @"http://www.youtube.com/watch?v=1Ziku4FLka4";

        wv = [[UIWebView alloc] initWithFrame:CGRectMake(0,10,viewBG.frame.size.width,viewBG.frame.size.height)];


    NSMutableString *html = [[NSMutableString alloc] initWithCapacity:1];
    [html appendString:@"<html><head>"];
    [html appendString:@"<style type=\"text/css\">"];
    [html appendString:@"body {"];
    [html appendString:@"background-color: transparent;"];
    [html appendString:@"color: brown;"];
    [html appendString:@"}"];
    [html appendString:@"</style>"];
    [html appendString:@"</head><body style=\"margin:0\">"];
    [html appendFormat:@"<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\"", strUTube];

    [html appendFormat:@"width=\"%0.0f\" height=\"%0.0f\"></embed>", viewBG.frame.size.width,viewBG.frame.size.height];
    [html appendString:@"</body></html>"];

    NSLog(@"html:%@",html);
    [wv loadHTMLString:html baseURL:nil];
    [viewBG addSubview:wv];

    [self.view addSubview:viewBG];

Then on another button click, I am calling home page of Youtube and fetching the URL opened on a button click event with following code :

NSString *currentURL = [webView stringByEvaluatingJavaScriptFromString:@"window.location.href"];
NSLog(@"currentURL2 : %@",currentURL);

But the URL results into result like http://m.youtube.com/watch?feature=m-trends&v=to7uIG8KYhg which cannot be played later on.

I also tried to open the URL on my Mac Book but in vain.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:32:51+00:00Added an answer on June 10, 2026 at 3:32 pm

    Simple trick extract videoID from below currentURL:

        http://m.youtube.com/watch?feature=m-trends&v=to7uIG8KYhg 
    

    Now create new Youtube VideoURL like

      NSString *newVideoURL = [NSString stringWithFormat:@"http://www.youtube.com/watch?v=%@",extractedVideoID];
    

    Now play this newVideoURL in embedded player.

    http://www.youtube.com/watch?v=to7uIG8KYhg

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am working on one music app where we can import music from iPod
I am working on an android app that has a database in which one
I am working on one app in which i need to upload video and
I am working on one android app. I want to connect my local PC
I've been working on a complex app with one main dashboard. I don't particularly
Okay, so I'm working on an android app. In one of my app's activities
I'm working on an iOS app where I want to load one view if
Currently I am working on a production app. One function acts like the settings.app
So I'm working on a CakePHP app, and had this line in one of
I'm working through an idea for an iphone app. One of the tech requirements

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.