Netflix player seek() inconsistent behaviour - javascript

I am using the Netflix videoPlayer API to control Netflix in a Chrome extension, and I am getting different behavior with the seek() function between machines. Machine 1 can control seek() with millisecond precision, while Machine 2 seems to only be able to seek on pre-defined boudaries. All are running Ubuntu 18LTS with Chrome 100.0.4896.75 (Official Build) (64-bit).
Machine 1 log:
Version: 6.0034.519.911
Esn: NFCDCH-LX-HTF16YUDF2YGKFVCYRJ3A9GF9H7RVN
JsSid: 164987005943084260, Epoch: 1649870627, Start: 1649870059, TimeZone: 240
Href: https://www.netflix.com/watch/80133015?trackId=14277281&tctx=-97%2C-97%2C%2C%2C%2C%2C%2C
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
--------------------------------------------------------------------------------
561.357|0|I|Playback| PresentingState changed, From: 3, To: 1, MediaTime: 60.001, AudioBufferLength: 238211, VideoBufferLength: 239548
561.359|0|I|MediaPresenterASE| Seeking, Requested: 120.000, Actual: 120.001, Cause: 1, Skip: true
561.567|0|I|Playback| PresentingState changed, From: 1, To: 3, MediaTime: 120.001, AudioBufferLength: 178211, VideoBufferLength: 179548
Machine 2 log:
Version: 6.0034.519.911
Esn: NFCDCH-LX-J5EWUE0WEKL01A5EUP9QQVGXQWR07G
JsSid: 164986955062224580, Epoch: 1649870664, Start: 1649869550, TimeZone: 0
Href: https://www.netflix.com/watch/80133015?trackId=14170286&tctx=2%2C0%2C7363e895-693b-49fb-ab7e-652cda8c88bc-402829570%2C6d31be72-de22-4cad-9be0-711eb9a14bf9_33273644X3XX1649867233503%2C6d31be72-de22-4cad-9be0-711eb9a14bf9_ROOT%2C%2C%2C
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36
--------------------------------------------------------------------------------
1106.457|0|I|Playback| PresentingState changed, From: 3, To: 1, MediaTime: 59.241, AudioBufferLength: 214950, VideoBufferLength: 229505
1106.459|0|I|MediaPresenterASE| Seeking, Requested: 120.000, Actual: 117.743, Cause: 1, Skip: true
1106.494|0|W|DFF| Restricting resolution due to high number of dropped frames, MaxHeight: 720
1107.138|0|I|Playback| PresentingState changed, From: 1, To: 3, MediaTime: 117.743, AudioBufferLength: 204491, VideoBufferLength: 190815
Both request a seek(120000), and Machine 1 seeks to 120.001, while Machine 2 seeks to 117.743 (as do any requests for 118 and 119). It is unclear if this is related to the "restricting resolution" message on Machine 2. I would like both machines to be able to seek() with millisecond precision.

Related

phantomjs and simple examples gives TypeError: Attempting to change the setter of an unconfigurable property

I'm working my way through the phantomjs examples but TypeError: Attempting to change the setter of an unconfigurable property. errors keep popping up. I wanted to pipe returned values to files but they are full of these error messages even with the simple examples see below.
var webPage = require('webpage');
var page = webPage.create();
page.settings.userAgent = 'Mozilla/5.0 (Linux; Android 9; SM-G960F Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.157 Mobile Safari/537.36';
page.open('http://m.bing.com', function(status) {
var title = page.evaluate(function() {
return document.title;
});
console.log(title);
phantom.exit();
});
Produces:
Bing
TypeError: Attempting to change the setter of an unconfigurable property.
TypeError: Attempting to change the setter of an unconfigurable property.
It should send back just Bing any workarounds?
I'm using PhantomJS 2.1.1 on Ubuntu 18.04 64bit.

How to catch google chrome audit lighthouse

How can I catch in Javascript a user running an Audit from Lighthouse in my website?
I'd like to see if there is a possibility, out of curiosity.
Edit:
Based on #DBS answer, I'd like to see that If I can catch it during the process
<script>
if (navigator.userAgent.indexOf("Chrome-Lighthouse") > -1) {
document.body.innerHTML = "Lighthouse!";
} else {
document.body.innerHTML = "No lighthouse :("
}
</script>
If by "catch", you simply mean detect it. The Lighthouse process includes a custom user agent.
Searching the user agent for the string Chrome-Lighthouse
e.g.
if (navigator.userAgent.indexOf("Chrome-Lighthouse") > -1) {
console.log("Lighthouse!");
} else {
console.log("No lighthouse :(")
}
I don't believe it's possible to "catch" in the debugging sense of interacting with the process.
You might be able to catch it from the User agent.
Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse
From Source Code

Undefined error in plupload dispatchEvent on Mac Safari

I am experiencing weird errors on Mac Safari with plupload.js. The method dispatchEvent has this line:
evt.type = eventType;
It sometimes throws this error:
TypeError: undefined is not an object (evaluating 'evt.type = eventType')" userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12
The evt object is declared at the top of the method:
var evt = {};
It is not re-declared anywhere below. I am not able to reproduce this error locally, I have it in my logs from other users. How can this happen? Might it be a problem with JS implementation on Mac Safari so that some other thread is erasing the evt object?
EDIT: The problematic line of code is here https://github.com/moxiecode/plupload/blob/3.x/js/plupload.js#L2200

can not get to all the element of ng-repeat in Protractor test by each(), which use to work in 1.4.0

This Code use to work in Protractor 1.4.0::
element.all(by.repeater('item in vm.occupations'))
.each(function(jobsInRepeater) {
jobsInRepeater.element(by.binding('item.Title'))
.click()
.then(function(){//someLogic});
protractor 2.1.0 gives the follwing error for this code
Message:
ElementNotVisibleError: element not visible(Session info:chrome=43.0.2357.124) (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1 x86_64) Stacktrace:
ElementNotVisibleError: element not visible (Session info: chrome=43.0.2357.124) (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1 x86_64)

JS Websocket stuck in state CONNECTING to TCPListener - VB.net

Note: The closest question I have found to mine is this one, but the answer is to send data via a proxy function that waits for the readyState to be 1. This is not a duplicate of that question though the titles are very similar; I know my issue lies in my server not passing data back to the client, but I don't know what to pass.
Details:
I have a TCP Listener defined in my server program as a New TcpListener(ipAd, 8001) and I wrote a client program as a New TcpClient() to connect to the server. These programs work as intended, where as soon as the connection is made, the client is ready to send data to the server.
After I completed the client and server, I began working on a web interface to act as the client, so I could send data to the socket from any device. Here is the javascript code for the websocket:
console.log("Attempting to connect...");
ws = new WebSocket('ws://192.168.0.10:8001/');
ws.onopen = function(msg) {
console.log('Connection successfully opened');
};
ws.onmessage = function(msg) {
console.log(msg);
};
ws.onclose = function(msg) {
console.log("Closed.");
}
ws.error = function(err){
console.log(err);
}
When I load the webpage, I see in my server console app that the connection is made. Here is the output:
GET / HTTP/1.1
Host: 192.168.0.10:8001
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-
cache
Upgrade: websocket
Origin: null
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Windows
NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36
Accept-Enc
oding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Sec-WebSocket-Key: key_here
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
So clearly the HTTP headers are sent and received; however, my server (currently) does not send anything back to the client, so when I try to issue ws.send("test"); from the websocket, I receive an error in console:
Uncaught InvalidStateError: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.
My Question: What do I need to send back to the client from my server to complete the handshake, so that I can send data with ws.send();?
You need to implement the server-side of a webSocket (or use a webSocket library that does that for you). Here's one sample implementation in VB. And a similar question with sample code.
A webSocket connection works like this:
Client makes http request to server with custom header requesting upgrade to webSocket protocol
Server responds that the upgrade to webSocket is OK and with a randomly generated security key.
After the server sends the response and the client receives it, then both sides switch to the webSocket data frame format for future data.
In addition, there are some mandatory messages that must be supported such as ping and pong to support the keepalive heartbeat that the client will use to know if the connection is still alive.
See this article for example responses and a description of the webSocket data frame format.
In addition, browsers enforce same-origin restrictions by default so if you are trying to connect from a browser to a different origin than the web page that the Javascript is in, then you will need the appropriate CORS headers from your server to enable the cross origin connection.
Here's a sample connection:
Client sends this:
GET /chat HTTP/1.1
Host: example.com:8000
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13
Server responds with this:
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
Then, data frames look like this:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
And, of course, the webSocket RFC official specification is here.

Categories

Resources