Chromecast - sender app - Cast icon not visible HTML5/JS - html

The problem is that cast icon is not visible even in sample examples by Google in sender application. Month ago i had to refresh the page couple of times to get an icon back or restart the device. Now nothing is working and the icon is missing but in chrome development tools it shows that it is correctly implemented. Do you know what is the problem?
I am creating cast button by:
google-cast-launcher
there are no errors in console
PS. I do also have had implemented the library
https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1

I found a solution. You need to use https:// instead of http://
otherwise the cast icon wont be visible
I hope it helps some of you
#edit
if you have problem with not showing icon and in console it shows :
CastVideos.js:125 Uncaught ReferenceError: cast is not defined
at CastPlayer.initializeCastPlayer (CastVideos.js:125)
at window.__onGCastApiAvailable (CastVideos.js:1004)
at chrome.cast.ha (VM1365 cast_sender.js:99)
in your html put script at the beggining of head and script to framework gstatic at the end of body.

You have to delay the initialization of Cast Player
let castPlayer = new CastPlayer();
window['__onGCastApiAvailable'] = function (isAvailable) {
if (isAvailable) {
setTimeout(() => {
castPlayer.initializeCastPlayer();
}, 1000)
}
};

Related

How to get specific error message from SourceBuffer

I have an HTML5 video with a MediaSource for its source. When I call SourceBuffer.appendBuffer() the SourceBuffer throws an error.
I'm able to detect when this error is thrown like so:
sourceBuffer.addEventListener("error", function() {
console.log(arguments);
});
However the "arguments" in this case contain an ErrorEvent with no meaningful message or data. Just a reference to the SourceBuffer that failed.
I need to figure out why it failed, so I can fix it.
Yes, this is one of the most frustrating parts about MSE... it's really difficult to debug. I think the issue is that the errors have to be standardized from browser to browser. Since there's a lot of
If you're using Chrome, the best place to look is chrome://media-internals.
As of Chrome 91 the media-internals pane is removed. Instead. go to
DevTools / hamburger menu (=== Customize and Control DevTools) / More Tools ▶ / Media
Then you'll have a Media tab on DevTools.

iOS 8 today widget stops working after a while

I've made a today widget for the german ice hockey league DEL.
I'm loading the next games from our server an show them in a tableView. The loading process is started in the proposed method "widgetPerformUpdateWithCompletionHandler". Initially i'm loading some cached data in "viewWillAppear".
Everything works great so far!
But after a while (one day) the widget stops working. When I open the notification center the widget appears normal, but it is never updated again. I have to remove the widget from the notification center and have to add it again. After that the widget works for a day and then again it stops working.
To see what the widget ist doing, I've added a simple white view with a status text above the table view while loading the data in "widgetPerformUpdateWithCompletionHandler" to see if the widget is doing anything. The white view appears when the widget is working. When it is not working the status view doesn't appear. So I think the method "widgetPerformUpdateWithCompletionHandler" isn't called after the widget is active in the notification center for a while.
I've got no clue what causes the widget to stop working. Any ideas?
I've got the same problem and I resolved it by calling completionHandler(NCUpdateResultNoData);
right after your network request even when the response hasn't been returned. I found that if completion handler is not called the widgetPerformUpdateWithCompletionHandler
will no longer get invoked, and therefore there won't be any more updates. Also make sure you call completion handler in all branches after your request call returns.
As others have mentioned, this is caused by not having previous called the completionHandler after widgetPerformUpdateWithCompletionHandler has been called. You need to make sure that completionHandler is called no matter what.
The way I suggest handling this is by saving the completionHandler as an instance variable, and then calling it with failed in viewDidDisappear:
#property(nonatomic, copy) void (^completionHandler)(NCUpdateResult);
#property(nonatomic) BOOL hasSignaled;
- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler {
self.completionHandler = completionHandler;
// Do work.
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
if (!self.hasSignaled) [self signalComplete:NCUpdateResultFailed];
}
- (void)signalComplete:(NCUpdateResult)updateResult {
NSLog(#"Signaling complete: %lu", updateResult);
self.hasSignaled = YES;
if (self.completionHandler) self.completionHandler(updateResult);
}
An additional problem is that once widgetPerformUpdateWithCompletionHandler: is stopped being called, there will never be another completion handler to call. I haven't found a way to make the system call widgetPerformUpdateWithCompletionHandler: again. Therefore, make sure your widget will also try to reload data through viewWillAppear: as a fallback, or some users might be stuck with a non-loading widget.
Calling the completionHandler with NCUpdateResultNewData within widgetPerformUpdateWithCompletionHandler before an async call comes back and calls it again with NCUpdateResultNewData or NCUpdateResultFailed seems to work.

Box iOS SDK: No on.progress call back for previewWithCallbacks

When downloading a file, I'm not getting an on.progress callback so am not able to display a progress bar. Works fine for file uploading.
What am I doing wrong?
Thanks,
Pete
BoxFile *boxFile = (BoxFile *)boxObject;
[boxFile previewWithCallbacks:^(id<BoxOperationCallbacks> on)
{
on.progress(^(NSNumber *ratio)
{
// update progress bar
});
on.after(^(BoxCallbackResponse response)
{
if (response == BoxCallbackResponseSuccessful)
{
We have the same problem but we manage to get the answer for this, although we did not try to implement it yet.
"Currently, the expected method to get progress on file downloads is
to register your object as an observer of the download queue ([Box
registerObserverForDownloadQueue:self];) and then to extend the
BoxObserver protocol and implement any of these callback methods that
you are interested in:
- (void)downloadDidBeginForItem:(BoxID *)itemID;
- (void)downloadDidProgressForItem:(BoxID *)itemID bytesDownloaded:(NSUInteger)bytes;
- (void)downloadDidCompleteForItem:(BoxID *)itemID withResponse:(BoxCallbackResponse)response;
- (void)downloadDidCompleteForAllItems;
Please remember to remove your object from the observers before you
expect your object to be deallocated because observers are currently
retained."
This question is no moot since Box have a completely new iOS SDK (v2.0), which does have the proper progress callbacks.

AS3 Trace an info message

I'm a AS3 developer but I'm not sure how can I trace this kind of messages in firebug as an info messsages.
I know that for an error I just need to inherit for an error but I'm not sure how can I trace this kind of messages.
This code:
trace("Hola")
will show "Hola" in Firebug, but I want the fancy Info icon at the beginning also the background of the line is blue.
Thanks for your help.
you can try https://addons.mozilla.org/en-US/firefox/addon/flashbug/
years ago I've used http://www.sephiroth.it/firefox/flashtracer/ not sure if anyone uses it still.
The trick is to use Debug version of flash player
In the case where you don't want to install the Flash Debug player (performance?), rather than using trace, route it to a Debug method that traces and logs to the console:
import flash.external.ExternalInterface;
var debug:Boolean = true;
function log(msg:String):void {
if ( debug ) {
trace(msg);
ExternalInterface.call('console.log',msg);
}
}
log('Hello World');
You should be able to throw that in a frame. If you're using class definitions, you'll have to interpret that code block as snippets.
Also note that in a browser that doesn't have console.log (like IE7) this will throw an error, so maybe you should test for console.log first and store the result in a global.
Notice the debug variable. When you want to turn debug logging off, just set debug to false. This is an overly simplified idea, but provides the basic concept.
Another way enhance this concept is to include a debug "window" if you will... really just a scrollable text box on top of everything else. This is helpful when dealing with devices that do not support logging, debug versions of flash or are just difficult to debug, e.g. mobile and AIR.

Facebook Login Handler doesn't get fired in Flex4 Facebook API

I have literally spent HOURS trying to solve this mystery... but simply can't seem to get hold of it.
I am using the same code lines (literally!) as the example here (official adobe tutorial) and I get different result.
protected function login():void
{
Facebook.login(loginHandler,{perms:"user_birthday,read_stream,publish_stream"});
}
protected function loginHandler(success:Object,fail:Object):void
{
trace ("login handler called");
if(success){
currentState="state_home";
Facebook.api("/me",getMeHandler);
//userImg.source=Facebook.getImageUrl(success.uid,"small");
Facebook.api("/me/statuses",getStatusHandler);
}
}
Everything works fine, i.e. everything till it is time to fire the loggedin event. I get asked to log in and all permissions are asked correctly. After I log myself in to facebook, the loggedin event doesn't fire. Is there any way of solving this problem??
And I am really desparate... :(
Have you tried debugging the JavaScript of the containing HTML page? I've found that the JavaScript can encounter errors in the communication back to your Flash movie, and it fails silently in the background.
Open the debugger and have a look for any errors - sometimes its down to conflicting embed object Ids in the HTML that throws it.