playing vimeo in IE8 with popcorn.js - internet-explorer-8

I can't get popcorn.js to play ball with IE8. I'm using the popcorn-ie8 wrapper, the media proto and vimeo plugin ONLY.
My code is as simple as this:
var video = Popcorn.HTMLVimeoVideoElement('#video');
video.src = 'http://vimeo.com/18359846';
var example = Popcorn(video);
example.play()
IE8 throws an error:
'MediaError is undefined', popcorn._MediaElementProto.js (58).
If I use a full package distro of popcorn.js and put the IE8 shim at the top, my IE leaks memory rapidly and crashes. I also had to disable memory protection in IE8 in order to capture the error, since otherwise the whole browser crashes.
So I've cut it down to just popcorn+ie8shim, the mediaelement core and the vimeo plugin.
I have set up a jsFiddle here: http://jsfiddle.net/EtepN/
You have to use this url to see the result in IE8, since jsFiddle doesn't work in IE8 : http://jsfiddle.net/EtepN/embedded/result/
-- edit --
getting closer; I've created a closure for MediaError so that IE8 doesn't throw an error on it being undefined - just define it as another object and set that to the MediaError object.
(function(w) {
var _MediaError = w.MediaError;
if(!_MediaError) {
w.MediaError = _MediaError = (function() {
function MediaError(code, msg) {
this.code = code || null;
this.message = msg || "";
}
MediaError.MEDIA_ERR_NONE_ACTIVE = 0;
MediaError.MEDIA_ERR_ABORTED = 1;
MediaError.MEDIA_ERR_NETWORK = 2;
MediaError.MEDIA_ERR_DECODE = 3;
MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
return MediaError;
}());
}
}(window));
Still not getting it to work in IE8 but that's one error down at least ....

Related

Action Chains fail in Safari browser

I`m trying to create move to element action using ActionChains in Safari 12.0 browser, but get the next error:
selenium.common.exceptions.InvalidArgumentException: Message: Encountered key input source with invalid 'value' in payload: {
actions = (
{
duration = 0;
type = pause;
}
);
id = key;
type = key;
}
The same test is passed success in any browsers (Firefox, Chrome, Ie, Edge etc) but fails in Safari.
Source code, which create this actions:
element_to_hover_over = driver.find_element_by_xpath('/html/body/div[7]/div[1]/header/div[1]/div/ul/li[1]/div[1]/span[1]')
hover = ActionChains(driver).move_to_element(element_to_hover_over)
hover.perform()
Commenting the line #self.w3c_actions.key_action.pause() from class ActionChains solved problem for me
But its a workaround and needs proper fix from driver

Prevent Browser Caching of UI5 Application Resources

We have an SAPUI5 App deployed on SAP PO. The problem is that whenever we do changes and deploy the new version of our application, the changes are not reflected and we need to do a Hard Reload and Clear browser Cache to fetch new changes.
This is causing a lot of issues as we cannot ask clients to clear cache after every change.
Below are the unsuccessful methods we tried so far:
Enabling "resources/sap-ui-cachebuster/sap-ui-core.js" in SAPUI5 bootstrap.
Using 'Application Cache buster' for application resource ( using sap-ui-cachebuster-info.json)
Setting HTML header to keep no cache:
<meta http-equiv='cache-control' content='no-cache, no-store, must-revalidate'>
<meta http-equiv='Expires' content='-1'>
<meta http-equiv='Pragma' content='no-cache'>
Clear cookies with below code:
document.cookie.split(";").forEach(function(c) {
document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/");
});
None of the above solutions have worked so far. This is what we see in Networks tab of Chrome:
NOTE: Application is deployed on SAP PO 7.4 ( JAVA Stack)
We had the same issue than you on SAP MII and I have spent months with several OSS Calls for SAP to provide an acceptable solution.
They did so in the SP3 of SAP MII (we haven't updated yet but I hope their correction is right), but this will not apply in your case as you're on SAP PO but it's still a Java Stack.
So I think you should open an OSS Call, recommending to SAP to consult SAP Notes:
2463286 - Issues when reloading JavaScript files
2459768 - Force browsers to reload modified resource files
They will probably redirect you to the following stack overflow topic:
http://stackoverflow.com/questions/118884/how-to-force-browser-to-reload-cached-css-js-files
But this is only a work around, SAP web server on Java stack doesn't seem to be working correctly and they have to provide a correction.
Hope this will help you.
EDIT
Hi,
Here is an update, there is a work around that we sometime use.
We have a URL parameter which is used to identify if a reload of the page is needed.
See below a JS snippet that we embed the index.html page of the SAPUI5 app.
Hope this will help you.
<script>
window.onload = function () {
version = undefined;
fCheckVersionMatch = false;
onInit();
};
/***************************************************************************
* Function launch when we start the application it test
* - if the Reload parameters is set in the url
* - if we are loading an hold application with a false reload value
****************************************************************************/
var onInit = function() {
checkParamReload();
};
/***************************************************************************
* Check in the url if there is the reload value and if this value is less
* than the difference with the date now => avoid when using favorite link
* to load a previous version with an incorrect time stamp
****************************************************************************/
var checkParamReload = function() {
var sUrlParameters = window.top.document.location.search;
var regexReload = /(\?|&)reload=([^&]*)/;
var aReload = sUrlParameters.match(regexReload);
var nTime = aReload == null ? NaN : parseInt(aReload[2]);
if ( isNaN(nTime) || Math.abs(Date.now() - nTime) > 60000 ) {
// In case no reload tag is present or it's value is more than 1 minute ago, reload page
reloadPage(true); // True means force reload => reset retry count.
}
};
/***************************************************************************
* Reload page and make sure the reload param is updated.
* If force reload is used, retry count is resetted, otherwise it is
* it is incremented up to a limit, which - in case it is reached - stops
* the reload process and instead display an error message.
****************************************************************************/
var reloadPage = function (bForce) {
var retries = 0;
var oLocation = window.top.document.location;
var sSearch = oLocation.search;
sSearch = queryReplace(sSearch, "reload", _ => Date.now());
if (bForce) {
sSearch = queryReplace(sSearch, "retry", _ => 0);
} else {
sSearch = queryReplace(sSearch, "retry", function (n) {
if (isNaN(parseInt(n))) {
return 0;
} else {
retries = parseInt(n);
return retries + 1;
}
});
}
if (retries < 10) {
// Reload Page
window.top.document.location.replace(oLocation.origin + oLocation.pathname + sSearch + oLocation.hash);
} else {
// Display error
document.getElementById('Error').style.display = "block";
}
};
var queryReplace = function (sQuery, sAttribute, fnReplacement) {
// Match the attribute with the value
var matcher = new RegExp(`(\\?|&)${ sAttribute }=([^&]*)`);
var sNewQuery = sQuery.length < 2 ? `?${ sAttribute }=` : sQuery;
if (sNewQuery.search(matcher) < 0) {
// If we could not match, we add the attribute at the end
sNewQuery += "&" + sAttribute + "=" + fnReplacement("");
} else {
sNewQuery = sNewQuery.replace(matcher, (_, delim, oldVal) => delim + sAttribute + "=" + fnReplacement(oldVal));
}
return sNewQuery;
}
</script>

addStream in firefox dont work - webrtc

I try use webrtc in a app, for realtime comunication, this in chrome work fine but in firefox i get error in function addStream, i am using adapter.js i suppose what it will solved all error of compatibility but the error keep.
pc = new RTCPeerConnection(pc_config);
pc.onicecandidate = function (evt) {
// my code here
}
pc.onnegotiationneeded = function (evt) {
// my code here
}
if(isChromium) {
object_user.pc.onaddstream = function (evt) {
};
} else {
object_user.pc.ontrack = function (evt) {
};
}
if(isChromium) {
object_user.pc.addStream(window.localstream); // <- get error in firefox
}else{
object_user.pc.addTrack(window.localstream);
}
I try to change addStream by addTrack of firefox but I get "Not enough arguments to RTCPeerConnection.addTrack."
The documentation for addTrack requires 2 argumuments, track and stream, which is probably why you get an error.
Syntax
rtpSender = RTCPeerConnection.addTrack(track, stream...);
Parameters
track
A MediaStreamTrack object representing the media track to add to the
peer connection.
stream...
One or more MediaStream objects in which the specified track are to be
contained.
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addTrack

How to dynamically load images in a layer using actionscript

I used the below code to load images that are present in my library:
Create_Image_With_Description();
function Create_Image_With_Description():Void {
this.createEmptyMovieClip("imageHolder", 600);
// Put Here Images URoL
imageHolder.loadMovie("Symbol 1");
// Position
imageHolder._x = 0;
imageHolder._y = 0;
// Size
imageHolder._xscale = 210;
imageHolder._yscale = 215;
// Example: my_mc.createTextField(instanceName:String, depth:Number, x:Number,
y:Number,width:Number, height:Number) : Void
this.createTextField("description1Field",1,10,203,120,20);
// Put Here Images description
description1Field.text = "Resident Evil: Afterlife";
}
Here symbol 1 is the image that i've converted into a symbol. When i tried running this i got an error saying "Error opening URL 'file:///E|/Symbol 1'".
I've also tried giving imageHolder.loadMovie("img1.jpg"); But still it didn't worked. Can anyone help me with this
Try replacing these lines:
this.createEmptyMovieClip("imageHolder", 1000);
// Put Here Images URL
this.attachMovie("img1", "img1", {_x:100, _y:100});

C# WIA with Automatic Document Feeder (ADF) retuns only one page on certain scanners

I have a HP Scanjet 7000 (duplex & ADF scanner) and a HP Scanjet 5500c (only ADF) and a scanner program I'm developing which uses WIA 2.0 on Windows 7.
The problem is that the code works perfectly on the older scanner model, but on the newer one the code seems to run just fine through the first page, then fail on the second. If I step through the code around the following line;
image = (WIA.ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatTIFF, false);
the old scanner stops and waits for another call to be made on the same reference, but the newer one just runs through all it's pages from the feeder in one continuous operation.
I notice if I'm using the default scanning program in Windows 7, the newer one returns a single .tif file which contains all the separate pages. The older one returns separate .jpg files (one for each page).
This indicates to me that the newer scanner is scanning through its whole feeder before it is ready to return a collection of images where the older one returns ONE image between each page scanned.
How can I support this behavior in code? The following is part of the relevant code which works on the older scanner model:
public static List<Image> Scan(string scannerId)
{
List<Image> images = new List<Image>();
List<String> tmp_imageList = new List<String>();
bool hasMorePages = true;
bool useAdf = true;
bool duplex = false;
int pages = 0;
string fileName = null;
string fileName_duplex = null;
WIA.DeviceManager manager = null;
WIA.Device device = null;
WIA.DeviceInfo device_infoHolder = null;
WIA.Item item = null;
WIA.ICommonDialog wiaCommonDialog = null;
manager = new WIA.DeviceManager();
// select the correct scanner using the provided scannerId parameter
foreach (WIA.DeviceInfo info in manager.DeviceInfos)
{
if (info.DeviceID == scannerId)
{
// Find scanner to connect to
device_infoHolder = info;
break;
}
}
while (hasMorePages)
{
wiaCommonDialog = new WIA.CommonDialog();
// Connect to scanner
device = device_infoHolder.Connect();
if (device.Items[1] != null)
{
item = device.Items[1] as WIA.Item;
try
{
if ((useAdf) || (duplex))
SetupADF(device, duplex); //Sets the right properties in WIA
WIA.ImageFile image = null;
WIA.ImageFile image_duplex = null;
// scan image
image = (WIA.ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatTIFF, false);
if (duplex)
{
image_duplex = (ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatPNG, false);
}
// save (front) image to temp file
fileName = Path.GetTempFileName();
tmp_imageList.Add(fileName);
File.Delete(fileName);
image.SaveFile(fileName);
image = null;
// add file to images list
images.Add(Image.FromFile(fileName));
if (duplex)
{
fileName_duplex = Path.GetTempFileName();
tmp_imageList.Add(fileName_duplex);
File.Delete(fileName_duplex);
image_duplex.SaveFile(fileName_duplex);
image_duplex = null;
// add file_duplex to images list
images.Add(Image.FromFile(fileName_duplex));
}
if (useAdf || duplex)
{
hasMorePages = HasMorePages(device); //Returns true if the feeder has more pages
pages++;
}
}
catch (Exception exc)
{
throw exc;
}
finally
{
wiaCommonDialog = null;
manager = null;
item = null;
device = null;
}
}
}
device = null;
return images;
}
Any help on this issue would be very much appreciated! I can't seem to find a working solution on the web. Just unanswered forum posts from people with the same problem.
we had a very similar problem and various solutions, e.g. by setting certain properties, did not help. The main problem was that the scanner (ADF) retracted all pages on startup, regardless of what was happening in the program code.
The process repeatedly led to errors, since "too much" was made before the next page was scanned. This applies in particular to the fact that another "Connect" was attempted.
For this reason, we have modified the code so that the individual pages can be read in as quickly as possible:
public List<Image> Scan(string deviceID)
{
List<Image> images = new List<Image>();
WIA.ICommonDialog wiaCommonDialog = new WIA.CommonDialog();
WIA.Device device = this.Connect(deviceID);
if (device == null)
return images;
WIA.Item item = device.Items[1] as WIA.Item;
List<WIA.ImageFile> wiaImages = new List<ImageFile>();
try
{
// scan images
do
{
WIA.ImageFile image = (WIA.ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatJPEG, false);
wiaImages.Add(image);
} while (true);
}
catch (System.Runtime.InteropServices.COMException ex)
{
if ((uint)ex.ErrorCode != WIA_PROPERTIES.WIA_ERROR_PAPER_EMPTY)
throw ex;
}
catch (Exception ex)
{
throw ex;
}
foreach (WIA.ImageFile image in wiaImages)
this.DoImage(images, image);
return images;
}
I see you're calling a method called SetupADF, which is not shown, that presumably sets some properties on the device object. Have you tried setting WIA_DPS_PAGES (property 3096) and/or WIA_DPS_SCAN_AHEAD_PAGES (property 3094)?
I have a blog post about scanning from an ADF in Silverlight, and I believe a commenter came up against the same issue you're having. Setting WIA_DPS_PAGES to 1 fixed it for him. I ended up modifying my code's SetDeviceProperties method to set WIA_DPS_PAGES to 1 and WIA_DPS_SCAN_AHEAD_PAGES to 0.
After alot of trial and error I stumbled upon a solution which worked for reasons I'm not quite sure of. It seems like the ShowTransfer() method was unable to convert the page to .png or .tiff WHILE scanning. Setting the format to JPEG or BMP actually solved the issue for me:
image = (ImageFile)scanDialog.ShowTransfer(item, wiaFormatJPEG, false);
I think I saw somewhere on the web that this method actually returns BMP regardless of the format specified. Might be that converting the image to png or tiff is too heavy as opposed to using bmp or jpeg.
On a sidenote, I'm setting the property setting: 3088 to 0x005 (adf AND duplex mode).

Resources