Programmatically changing the up-next video on Youtube - javascript

I am writing a browser extension that would allow me to manipulate what video will be played next on Youtube. However, I'm having a hard time finding out what data I need to modify to update the next video.
I've tried to look at the "add to queue" buttons, since they modify what video plays next. However, due to lack of experience with chrome dev tools I can't track down what events they trigger that will change the up-next state.
I'm at a bit of a loss on what to do next other than bruteforce translating YouTube's minified javascript code into a readable format until I find the necessary functions.

Why don't you grab the video URL and put it inside your local storage when youtube go for reloading the next video you can block that request and load your URL as the next video.
**or**
Use Chrome Network Inspector to see the request made by youtube when the user hit the Add to queue button.

Related

Remove All User Controls Facebook Video Embed

I'm aware this question exists, please don't mark this one as a duplicate as things have changed since it was originally posted.
I am looking to embed what's called a "secret" (aka private) Facebook video onto a sales page to serve as a video sales letter. The video needs to play automatically (for as many devices as possible, anyways) and needs to have all video control options removed.
Basically it's click to play, click to pause, and if they know to use the arrows to FF or rewind, then, so be it. But that'll be less than 1% I'm assuming.
In the old solution the person mentioned Facebook having the option data-controls="false".
When trying to use this parameter now the entire video locks up and suggests the user to reload the browser.
Is there a way I can get around this? I'm thinking building out a custom player and seeing if I can set the FB video as the source, but even then it seems like there will be a page name and share option overlay on the video.
Any ideas?

Google Chrome Autoplay Policy Replaced disable-gesture-requirement-for-media-playback In Version 60.X

I have a PHP webpage I created for our office and it automatically refreshes every minute looking for new changes in a bunch of different databases. There are many different notifications I play in the form of wav files to our end users when changes are made.
For example I notify the employees on these events:
Their AM Break
Their Lunch
Their PM Break
When a new article is posted to our KB
BUT, most importantly:
I have an IFrame within this same page and the IFrame refreshes every 5 seconds looking for changes in a special table called "override_request".
When someone clicks a button requesting for an override a sound will alarm for a large group of employees to accept the override. The sound will repeat every 5 seconds until someone accepts the override. This may sound annoying but this is a call center and every 5 seconds that someone waits while a customer is on the phone is crucial.
In earlier versions of chrome background audio would play no matter what tab or application you were in. Around version 54.X Chrome disabled the background audio by default and later provided a flag called (disable-gesture-requirement-for-media-playback)
With the latest release of Google Chrome version 60.X up they have removed the (disable-gesture-requirement-for-media-playback) and provided another flag called (Autoplay Policy). There are two big differences between the new flag and the old flag.
First, the new flag allows for background audio to play only if background audio is played prior to switching tabs. That's not the problem, I created a blank audio file to load upon logging into the site and it resolved that issue.
Now, the problem:
Once the new flag (Autoplay Policy) recognizes the background audio the first time upon login, it allows the audio to play in the background until the page performs a refresh! Once the page automatically refreshes it resets the flag that was allowing the background audio. Chrome is recognizing the fact that the page refreshed and the user wasn't on the page at time of refresh so it blocks any further background audio from that tab until it is brought back into the foreground.
Does anyone know of another flag or javascript that will allow the page refresh and keep the background audio notifications alive?
I had very similar problem. I don't have a solution but my work around involved running a portable version of chromium 53.0.2767.0. It allows me to have background audio play in any open tab without any focus. I imagine you had to do something similar.

stop loading/buffering the video with projekktor/jquery/javascript

On my website, I'd like to be able to stop the video loading. Can I do it with jquery? What're my options?
The need is that my website has many videos, when a user with a limited internet connection wanna see a one-hour video then decides that he wants quit the video page (ajax only is performed), the video continues its loading anyway, so if does this with two or three videos his browser will freeze to death. So unless he refreshes the page, the video loading goes on til it's done.
Given that my web's based on apache2, symfony2/php5, projekktor/jquery
Check this answer - HTML5 Video: Force abort of buffering
Apparently removing the value of the src attribute will cause the video to stop loading/buffering
The OP also suggested stopping the video first to prevent any errors in the Browser console
One way would be to split the page into multiple single video pages. It still doesn't solve the problem completely but at least user's resources are used in to a smaller extent.
Another idea that I've had is to set the source of the video to an empty string when the user stops the video. As far as I've read online it frees up the space and leaves the video blank. There should also be a button to set the source to the original path should the user want to play the video once again.
The second idea provokes minor issues such as being unable to continue the video from the moment the user stopped it but I recon it's still better than taking up user's connection to load it.
Why don't you use the API to play&pause the video: API
player.setPlayPause():Boolean
Sets the player to pause if its playing or vis versa.
Ore one of these:
player.setPlay():Boolean
Sets the player to play. If its already playing no changes apply.
player.setPause():Boolean
Sets the player to pause . If its already paused no changes apply.
player.setStop():Boolean
Sets the player to stop . Will cause the playback component to stop immediately and displays the current itemĀ“s poster image. Furthermore the start-button shows up.

Remove video when it is completed

I am looking to have a video start when a page loads, but once the video has completed, to hide the video (remove the layer possibly). I saw it on a yoga site a few years ago where a video message from the owner appeared over top the content when the page loaded but then dissapeared after the video was done. Not even sure where to begin looking for something like this.
This is something that needs to be handled at the player level. Many flash players or frameworks allow you to register for an event. One event might be on video complete. First get this working. You may not be able to do this from javascript. For example, adobe's strobe player requires you to write a swf plugin which would be loaded in the flash player. Not trivial.
After you have registered it, you can easily close the window by executing some javascript function.
Let me know if you have more questions.

How to detect time on a playing Flash video

I have a video playing on my page. I want to show and hide some div's when the video reaches a certain point. Lets say hide something on 10th second and show it again on 20th second.
I can easily do it in HTML5 with video tag and currentTime attribute but for IE I have to create the same functionality and I think with flash based videos (from YouTube or something like that).
Is there a way to detect the current time of a video playing on my website, embeded from YouTube, Metacafe or any other video sharing site?
I know I could detect it in flash and make it run some JavaScript function but I don't have flash nor have the skills to do it in AS3.
Is it possible to do it from JavaScript level or does any video sharing website out there provides this kind of functionality for their videos?
You could look into using flowplayer, it exposes events for meta data and timing.
You can use ExternalInterface to communicate between flash and js. So inside the flash app, when the video reaches the defined time, you can trigger a call to js function, doing whatever you need with the divs.
Since you will need to receive a stream and you need to detect a specific point in the video I thing you have read this inside flash.

Categories