samedi 16 juin 2018

c# browser does not accept iframe variable source

I want to make an audio player and I made a html page in which I some API that extracts YT audio and gives link. Also I want this to be in application and I insterted web browser with the html page in C# App. And the problem comes when I want to insert a variable in the iframe source. When the code is

<iframe class="button-api-frame" src='<?php echo $final; ?>' width="100%" height="100%" allowtransparency="true" scrolling="no" style="border:none"></iframe>

it displays "Can’t reach this page". But when the code is

<iframe class="button-api-frame" src="https://youtubemp3api.com/@api/button/mp3/8cHgTBBlqq4" width="100%" height="100%" allowtransparency="true" scrolling="no" style="border:none"></iframe>

and there is a link in the src there is no error. Please help me :) <3 Here are the both files:

This is the html file:

<html>
<head>
<title>Player</title>
<meta http-equiv="X-UA-Compatible" content="IE=9" >
</head>
<body>

<audio id="mySong" controls>
    <source src="song.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

<form action="index.php" method="POST">
    <input type="text" name="link"  size="50">
    <input type="submit" name="link_btn" />
</form>

<iframe class="button-api-frame" src='<?php echo $final; ?>' width="100%" height="100%" allowtransparency="true" scrolling="no" style="border:none"></iframe> 
</body>
</html>

This is the c# file:

using System.Net;

namespace MP3Player
{

public partial class MainForm : Form
{
    public MainForm()
    {
        InitializeComponent();
        string webpage = "C:\\xampp\\htdocs\\player\\index.php";
        webBrowser1.Navigate(webpage);

    }
    void Button1Click(object sender, EventArgs e)
    {
        using (WebClient wc = new WebClient())
        {
            wc.DownloadProgressChanged += wc_DownloadProgressChanged;
            wc.DownloadFileAsync(new System.Uri("https://youtubemp3api.com/@download/320-5b24fe1e0bde6-10000000-250/mp3/SH5VG06ahO0/Gery-Nikol%2B-%2BNAD%2BZAKONA%2B%255BOfficial%2B4K%2BVideo%252C%2B2018%255D.mp3"),
            "C:\\xampp\\htdocs\\player\\test.mp3");
        }
    }

    void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
    {
        progressBar1.Value = e.ProgressPercentage;
    }


}
}




Aucun commentaire:

Enregistrer un commentaire