How to play video file in jmeter - wordpress

I have wordpress site with video player(JW player). I want to load test using jmeter. But i dont know how to do that?

JMeter doesn't act like a browser hence it won't "play" the video via JWPlayer. If you need to check whether your wordpress deployment will be able to serve video content and the video content itself is being hosted by you it is possible to simulate hundreds and thousands of users which are downloading videos.
If you look into wordpress page source you will see something like
<span class="jwvideo" id="hero-video_media" style="opacity: 1; visibility: visible;">
<video x-webkit-airplay="allow" webkit-playsinline="" src="https://content.jwplatform.com/videos/XjiIpRcb-1080.mp4"></video>
</span>
You're interested in https://content.jwplatform.com/videos/XjiIpRcb-1080.mp4 bit as this is the URL of the video file.
You can easily get the URL with the XPath Extractor using the following query:
//video/#src
And use simple HTTP Request sampler to simulate video download.

Related

Implementing cookies on a dismissible slide-in panel with AMP

I'm implementing a slide-in-on-scroll newsletter signup form on our site, which is built as AMP-native.
I added a button that hides the div on tap using amp-bind, but I'm struggling to get my head around how to save the closed state with cookies/localStorage in AMP.
I've gone through the favorite button example code - https://ampbyexample.com/advanced/favorite_button/ (as recommended here on SE), but I don't see how it relates to this particular use-case, especially with the use of amp-list.
Based on what I've read and few examples I found the credentials="include" attribute is needed, as is a valid CORS json endpoint and an auto generated client id appended to the endpoint url using AMPs variable substitution, but I'm not sure how to put it all together.
I took a stab hacking something together using the favorite button example, but the tutorial doesn't say much about how to setup the CORS endpoint and that particular example is for storing multiple likes to a single endpoint, as apposed to storing a specific users viewing preferences.
Here is my rough (poking-around-in-the-dark) stab at the code:
<form method="post"
id="side-newsletter-wrap"
action-xhr="/prefs&clientId=CLIENT_ID(prefs)"
target="_top"
on="submit:AMP.setState({
showSideNewsletter: !showSideNewsletter
});
submit-error:AMP.setState({
showSideNewsletter: !showSideNewsletter
});">
<button on="tap:side-newsletter-wrap.hide" class="close-button"><i
class="fa fa-times"></i></button>
<amp-list width="320"
height="360"
credentials="include"
items="."
single-item
src="/prefs&clientId=CLIENT_ID(prefs)">
<template type="amp-mustache">
{{#.}}
<?php winefolly_load_fragment('newsletter-embed'); ?>
{{/.}}
{{^.}}{{/.}}
</template>
</amp-list>
</form>
For the prefs endpoint, I'm guessing I'd need to register a new endpoint in WordPress that outputs simple array with the preferences?
Something along the lines of:
{
showSideNewsletter: "true",
winesIndexView: "grid",
winesIndexSort: "title"
}
I also tried the amp-user-notification component (which has the closed state built in) but that felt a bit hacky and the newsletter embed code (via iframe) doesn't get loaded due to a known bug - https://github.com/ampproject/amphtml/issues/18995).
Any suggestions would be much appreciated.
Chris
You're right amp-user-notification is the correct approach. Is there a way to implement the newsletter form in AMP until the amp-iframe bug is fixed?
Another way is to use amp-access, which allows you to change the layout of the page on page load. You have to store the user preference server-side though using the READER_ID to identify the user. Storing this server-side is required as you might not be able to write cookies if the page is served from the AMP Cache due to ITP 2.0.

scraping video links from lazy loaded videos

I am trying to scrape a video from a page using a package called icrawler, but that video is not rendered instantly when a page loads, so when I get the html code of that page, the video tag doesn't exist but it does if I open the page in the browser and inspect.
How do i wait for the page to load the video before crawling it ?
The page most likely loads the video using javascript so, you would need library capable of rendering/executing HTML and javascript.
I took a quick look at icrawler and according to the doc it uses Cheerio which quoting from its doc "does not produce a visual rendering, apply CSS, load external resources, or execute JavaScript".
The same docs mention that you could use something like PhahomJS (seems to be abandoned) or JSDom. Another alternative is to use Selenium.

URL Rerwriting + ASP.NET Image Gallery ajax upload not working

I have a CMS that uses HeliconApe to rewrite requests with the following rule
RewriteRule ^/(.*)$ /custompage.aspx?pagename=$1 [NC,L,QSA]
I am also using an image gallery (https://cutesoft.net/ASP.NET+Image+Gallery/) to provide a simple, easy to use image gallery in a CMS and I am having trouble getting the galleries upload to work with Apes URL Rewriting.
When a user requests a page, for example /contact-us.aspx, they are served /custompage.aspx?pagename=contact-us.aspx and /custompage.aspx generates the content, sets the form action to /contact-us.aspx, and adds the gallery with ContentArea.Controls.Add(Page.LoadControl(New DotNetGallery.GalleryBrowser))
When I try to upload a file, for example logo.png, with the ASP.NET Image Galleries built in uploader I see 3 notices in the console
First there is a post to
/contact-us.aspx?UseUploadModule=Dynamic&_Namespace=DotNetGallery&_UploadID=ctl00_ContentPlaceHolder1_ctl02_UploaderImage_1436363874058_1&_UploadControlID=ctl00$ContentPlaceHolder1$ctl02$Uploader&ContextValue=!3wEWAQU1QzpcVXNlcnNcdHdpbGJlcnRcQXBwRGF0YVxMb2NhbFxUZW1wXEFqYXhVcGxvYWRlclRlbXDTV65TuH6b!1qTC8Eov!1tLoCrIFSZy43V46b1KWs!1urZg!2!2&_VFN=logo.png&_Addon=upload&_AddonGuid=d6cd8556-af6f-3785-743f-257780b216b8
If I follow the link I see a file with the following contents but I think that is because I am viewing it without posting my own data (which I dont know how to do?)
<script type='text/javascript'>if(window.parent.CurrentUpload)window.parent.CurrentUpload.UploadError('ctl00_ContentPlaceHolder1_ctl02_UploaderImage_1436361349705_1','Unable to find the uploaded file from StreamManager(sm==null).','')</script>
Then a post to
/contact-us.aspx?UseUploadModule=Dynamic&_Namespace=DotNetGallery&_UploadID=ctl00_ContentPlaceHolder1_ctl02_UploaderImage_1436363874058_1&_UploadControlID=ctl00$ContentPlaceHolder1$ctl02$Uploader&ContextValue=!3wEWAQU1QzpcVXNlcnNcdHdpbGJlcnRcQXBwRGF0YVxMb2NhbFxUZW1wXEFqYXhVcGxvYWRlclRlbXDTV65TuH6b!1qTC8Eov!1tLoCrIFSZy43V46b1KWs!1urZg!2!2&_VFN=logo.png&_Addon=verify&_AddonGuid=d6cd8556-af6f-3785-743f-257780b216b8
Which fails with a 404 and alerts http error1 :404:Not Found
If I change the form action to /custompage.aspx?pagename=contact-us.aspx then the upload works.
I have tried contacting the galleries developers but they have never responded and the live chat isn't very helpful.
So I guess my questions are what might be causing this issue, is there any way to debug proprietary controls contained in dlls, and is there some setting or code I might be missing to make everything play together nicely?
Thanks!

How to add background music in asp.net without bgsound and embed

How to add background music when a website loads for the first time without using embed and bgsound.I am using visual studio 2010 and these two are not supported in this.
I am developing website using master page and i want to use the code in master
page.
What is the best practice to to be able when I open my website and some music starts f sometime.I am not much expert in .net with c#.So finding some problem in it.
If browser also matters?
Regards,
suparna
Add the following code anywhere in the body of your HTML document to embed a music file and play it automatically when a visitor browses your website.
<audio src="music/yoursongname.mp3" autoplay="autoplay" loop="loop"></audio>
Change the "src" attribute so that it contains the path and filename of the music file that you want to embed.
Note: Add the "loop" attribute if you want the music file to play over and over

How can i stop html5 audio from auto download

I am using this
<audio src="audio.mp3" />
Now that file is big and system automatically downloads it when someone loads the page.
is there any way that when someone press play , only then system downlaods. Because that player is in my every page and it wastes the BW
You can use the preload='none' attribute. Documentation here
The "none" attribute:
Hints to the user agent that either the author does not expect the user to need the media resource, or that the server wants to minimise unnecessary traffic. This state does not provide a hint regarding how aggressively to actually download the media resource if buffering starts anyway (e.g. once the user hits "play").
Your HTML could look something like this:
<audio preload="none">
<source src="audio.mp3" type="audio/mpeg" />
Your browser does not support this audio type.
</audio>

Resources