Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Inject JS code into cefsharp(inject youtube iframe)

$
0
0

I looked into lots of writing so I thought the code that I wrote should be working as well but it doesn't. So I need help with finding out what is wrong with my code.

    private void Music_Control_JS(object sender, FrameLoadEndEventArgs e)    {        if (e.Frame.IsMain)        {            string url = e.Frame.Url;            if (url.Contains("?autoplay=1"))            {                music_player.ExecuteScriptAsync(@"                var tag = document.createElement('script');                tag.src = 'https://www.youtube.com/iframe_api';");                music_player.ShowDevTools();            }        }    }

so what I'm trying to do here is whenever music is played("autoplay=1") cefsharp will be loaded with youtube video and automatically play but in the meanwhile, I want to inject js code in to html. But it seems like it is not working. I check js is not injected using showdevtools.

what I'm trying to do using iframe api is to control youtube video using c# component(button, slider, etc)


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>