Showing a YouTube video in a Google Chrome extension - google-chrome-extension

I would like to embed a YouTube player onto a page and show it to a user. If a foreground popup is used to host the player then, when the popup loses focus, the player is destroyed because the entire popup is removed.
I was hoping to use webKitNotifications.createHTMLNotification() and embed a player inside of an HTML Notification, but the spec has since been deprecated.
Just curious if anyone has any really crafty ideas on how to achieve this? I suspect hosting the YouTube player on a background page is a violation of YouTube's Terms of Service.
Looking through the dev. channel APIs:
http://developer.chrome.com/extensions/notifications.html - Too restrictive compared to HTML Notification. Doesn't look like I can embed a YouTube player inside one of these guys.
and... that's really about it.
Advice appreciated. Thanks.

You can simply have an HTML file in your extension for your page, for instance video.html, list it in your manifest under web_accesible_resources, and show it using:
chrome.tabs.create({url: chrome.extension.getURL('video.html')});
Inside your page you can use whatever method you want to embed the YouTube player.

Related

How YouTube website can use autoplay feature function without DOMException

I wonder why YouTube can use autoplay feature without DOMException because when I tried to use <audio/> and <video/> tags with autoplay when loaded, It's show an DOMException error. I tried another way by set an attribute playInLines={true} and muted={true} it first, then called ref.current.play() and finally unmute it. Unfortunately, the browser isn't allow to play without user interact first by showing DOMException error.
When I using YouTube website, I noticed that YouTube won't autoplay until I switched back to YouTube tab, the video is autoplayed.
I searched from internet that YouTube website is built from the framework that load only the element that it needed, the other element won't refreshed.
Is YouTube a Single Page Application. If it isn't, when the user interacted first time on loaded, can the website play the videos forever? (not counted the AFK interruption (YouTube Premium user won't encountner this))
I don't have any knowledge but I guess that YouTube is using the both of <audio/> and <video/> tags.

Problem with insertings gifs (giphy api) in context script popup

I'm working with chrome extension to use giphy API. Basically user from any website point of view can make a request to giphy to get some gifs if he makes double clicks on some words on those websites. For example, the user clicks on 'car' word in some article and then makes a request to giphy, he gets gifs proposals.
Plugin is working as expected for many websites, but not for all. In one (for now) website the request is ok, the response contains gifs, extension background receiving that gifs, but after trying to add these gifs to the DOM (content script popup) network shows (canceled) and src of that files have value = unknown.
I suppose it's related to some security reasons, am I right? I yes, what can I do, to insert gifs to my extension popup safely? Are there any security risks for the user when he gets gifs from giphy?

How to Make Gushup Web widget full screen and open by default

I am working Gupshup Chat bot,
I am trying to make Gushup bot full width i want the Chat bot to be full width and the Chat window to open by default when the chat window is loaded.
Please someone should tell show me how i can achieve this, am using the Gushup web widget on my website homepage but i need it to be full width to cover the whole of the page and also to be open by default.
Thanks
copy iframe html generated by chat popup using browser inspector

Display web sites and web apps with Chromecast

Can Chromecast be used to display a web site or web app? All the sample sender/receivers I've seen so far show how to play videos. The docs posted so far are minimal as best, just an API reference with little explanation what any of it does. I just want to send a URL of my choosing and have that page displayed on the TV. There's no user interaction required past that point. Assuming that's possible, does anyone have sample Chrome sender and receiver code for that?
I was able to modify the Github sample Project > googlecast/CastHelloText-chrome
to show a web page.
In the receiver.html file, I replaced the DIV with an IFRAME and styled it for 100% width and height.
Then in the displayText() function I changed innerHTML to src.
The only modification made to the sender chromehellotext.html was to replace YOUR_APPLICATION_ID with the app id created by registering the receiver.
Note that some sites like Google and Yahoo will not display inside an iframe. If you really needed to do that you could skip the iframe and just set window.location.href to the URL. That, of course, will overwrite your receiver code so the only way to change URLs would be to manually disconnect first and reload. I tried using window.open instead but that did not work.
One could imagine writing a Custom Receiver that has an iframe that wraps any website. Your sender would could then send webpages to your receiver, and the onLoad would set the the URL of the iframe. Don't have any code, but it's fairly simple to write.
There is a simple way to do that with the hellotext sample. You can send the html by typing that into the text field.
<iframe src="http://mywebpage.com" style="width:1280px;height:720px"></iframe>
To provide extra info from the current answer, as this post comes up near top on most searches.
Thing to search for is Digital Signage, this is the sort of industry word.
following GreenScreen Chromecast works okay. Greenscreen
host solution is Sign Simple - which looks to be same approach as Greenscreen without you needing to host the receiver web page.
Similar hosted solutions using Raspberry Pi can be found.
Of note: with GreenScreen and the CastHelloText, I could not get 1080p only 720p, some comments mention Video only in 1080p, but Images in 720p, which I take to mean html pages aswell.
Chromecast can indeed be used to display an arbitrary URL.
This can be done from plain old Chrome, using 'url-cast-receiver'. (Usable 'demo' page, GitHub project page.)

Embed YouTube videos in thirdparty player

Is there any website video player that I can embed YouTube videos in that also displays a playlist?
I want to be able to see the playlist and as far as I know the YouYube provided player that allows for playlists doesn't show the list unless you click on the playlist button in the top left. I want something with a playlist under or beside the video window that shows at all times.
youtube uses an iframe (as simple as that) to deliver content. Any website can display youtube playlists if the url in the "embed code" has the variables to do that. I forget the url but I am sure it is possible. I hope I got your question right...

Resources