Showing posts with label Video. Show all posts
Showing posts with label Video. Show all posts

Wednesday, 4 March 2020

Samsung Phones SmartView Application Bug

Fixing Problems With Samsung Phone SmartView Application

By Strictly-Software 

I have a Samsung Galaxy S8 mobile phone and recently I have had issues with the inbuilt SmartView application that allows you to mirror the screen of your phone to nearby devices such as Televisions, Rokus, Chromecasts and other Wifi enabled devices.

You access the app by using the swipe down settings panel at the top of the phone. It's on the second page accessed by swiping left and it's in the top right hand corner. See the below screenshot of my settings panel.



Whilst many applications that let you play videos have a "Play with external device" option that allows you to select the useful app AllCast before the device to then show the video on, some apps don't have a Chromecast beam square or option to play on an external device. 

This is where mirroring your screen is useful as you can just mirror yours phones screen to a TV and anything you do on the phone is then shown on the TV. The downside is that you can't use the phone or other apps whilst mirroring without your TV showing that app. However if you can use AllCast 
you can play a TV show, film or video from your phone on your TV but still use your phone to access other apps or make calls.

Up until last week everything worked fine, I could select SmartView and the apps little loading icon spins before local devices are shown to pick from. In my lounge I can pick from my Samsung 4k TV or the Chromecast device attached to it. This also allows me to beam videos from apps like YouTube that I don't want to mirror my phones screen to, or apps like sporting apps that don't have options to use AllCast to beam with.

In another room I have a Panasonic TV which also has a Roku attached and both could be used by AllCast or my phone to mirror to.The SmartView app used to be able to pick all 4 devices up and I could choose which TV or device to mirror my phone to.

However for some reason as I was watching a football game by mirroring my screen so the app could show the game on a big screen I left my pad. The connection was disconnected but when I came back I tried to use SmartView to re-connect it to my TV, but no devices were shown as available. In fact it didn't even look like it was scanning the room to find any devices to play to. Nothing was spinning in the corner and only the About Us and Contact us options were shown.

I filed numerous bug reports using Samsung's useful Members app and I had a reply that told me to go into System Settings, Applications, Select Show System Apps, choose SmartView then clear its cache. I did this but it didn't fix anything.

However tonight I came across a fix. I had to turn developer options on. You do this by going into Settings then About Phone and in there select Software Information before clicking on the Build Number about 7 times and it will give you the Developer Options.

In there you scroll down to Networking and turn on the option called "Wireless Display Certification"..



I then went into SmartView and it started spinning again, however a new panel appeared at the bottom with numerous WiFi connection options that I just ignored.



I then just scrolled to the bottom of these options and there appeared my selection of devices, in this case my TV and Chromecast.



And on choosing one, once again my phones screen was now mirrored to my TV.

I have no idea why this worked or what stopped SmartView from working in the first place but by doing my own debugging and playing around with the networking options I managed to solve what Samsung Tech Support couldn't. 

Hopefully this fix may help other Samsung phone users who have the same issue as me.

By Strictly-Software

© 2020 Strictly-Software

Sunday, 17 June 2012

Flash Crash Problems with Firefox 13.0.1 and Adobe Flash 11.3.300.257

Flash Crashing constantly in Firefox 13.0.1

All day I have been experiencing problems with Firefox and Flash.

Flash is notoriously buggy and crashes a lot which is why HTML5 offers so much hope for those of us wanting to watch movies online, on our phones or devices and Youtube style with the VIDEO tag and a wrapper iFrame.

I don't have a fix but I just wanted to put it out there that Flash version 11.3.300.257 is causing constant problems when used with Firefox 13.0.1.

A movie will start playing and then hang or the screen will go black before the "flash crash" message appears.

I am trying to watch some comedy central with another header plugin and up until today I have had no problems at all.

I don't know if this a problem with Flash or Firefox or a combination of both but it is really starting to piss me off. I have re-installed both Firefox and Flash multiple times.

I don't know why Adobe cannot get their act together with Flash as people are working their ass off to accommodate them and their notorious bugs, high CPU and memory leaks on devices whereas before they were just going to ditch Flash altogether and wait for HTML5 to spread.

If anyone else is having the same problem with Flash crashing let me know.

Sunday, 21 November 2010

Auto Resizing OBJECT and EMBED videos for display on import

Importing Videos from feeds into blogs

I have done a lot of work lately updating the popular WP-O-MATIC wordpress plugin that auto imports content into Wordpress blogs from feeds.

Mainly this is because the plugin is no longer supported having been taken over by the product WP Robot which seems to be based on the original source but with a lot more features.

One of the main things I find myself doing is having to resize videos so that they fit into my content which is 520 px wide. If you are importing content from various other blogs you can never guarantee that the videos will always be of a similar size and if you want your blog to look nice and not have scrollbars everywhere then the best way is to reformat the imported content so that any videos are resized to your desired dimensions.

As Wordpress and WP-O-Matic is PHP I use the preg_replace function to accomplish this using the callback function to handle the formatting. It looks for OBJECT or EMBED tags where the width is over 500px and if any are found I resize to 500 * 375 (4*3 ratio).

The function is below.

$content = preg_replace_callback("@(<(?:object|embed|param)[\s\S]+?width=['\"])(\d+)(['\"][\s\S]+?>)@i",
create_function(
'$matches',
'if($matches[2] > 500){
$res = preg_replace("@ height=[\'\"]\d+[\'\"]@i"," height=\"375\"",$matches[1] . "500" .$matches[3]);
}else{
$res = $matches[1] . $matches[2] .$matches[3];
}
return $res;'),$content);




Saturday, 27 February 2010

Handling YouTube Videos in Feeds

Reformatting HTML to include YouTube video links

If you use XML feeds to import content into your site or blog you may have experienced the problem that your blogging software or add-on tries to err on the side of caution for security reasons or just messes up the import and in doing so any EMBED or OBJECT tags are stripped in the process.

This is especially annoying when the content is for a blog or news site and the imported content was linking to YouTube videos as it means you have to go through all the posts by hand and reformat the HTML so that the original video is shown.

Luckily even though the actual OBJECT tag gets removed you are usually left with a link to the video on YouTube's site. This can be utilised in a simple regular expression so that you can reformat your content and replace this link with the actual OBJECT HTML.

The regular expression is pretty simple and looks for any anchors pointing to YouTube's site and captures the video ID in a sub group. This sub group is then used in the replace statement as the value for the PARAM and EMBED values that require it.
// use preg_replace to replace anchors with OBJECT/EMBED
// $input is the source HTML

$html = preg_replace("/<a href=\"http:\/\/www\.youtube\.com\/watch\?v=([A-Z1-9]+)\">[\s\S]+?<\/a>/i","<object width=\"425\" height=\"344\"><param name=\"movie\" value=\"http://www.youtube.com/v/$1&hl=en_GB&fs=1&\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/$1&hl=en_GB&fs=1&\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"425\" height=\"344\"></embed></object>",$input);

I am using PHP as an example here but the regular expression would be the same across all languages.

Either wrap a call to this function in your own import procedure or if you are using an add-on like Wordpresses WP-o-Matic then you should utilise it in the rewrite section when setting up a new feed import.


Sunday, 8 November 2009

Displaying Flash and Video content

The various methods of outputting flash and video content

I was looking at some YouTube videos earlier and the code that they use to allow users to embed the movies into other HTML has changed. I know it changed quite a while back actually but it got me thinking about the various methods for displaying video content on the web.

I am pretty sure that they used to use the old combo method which used to use an outer OBJECT tag designed to work in IE with classid and codebase attributes and then some PARAM tags and then an EMBED tag to handle all other browsers. Even though EMBED works across browsers its not a standard compliant method for displaying content however because it works across all browsers its used everywhere.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" data="http://www.youtube.com/v/FrYlNNy929Y&hl=en&fs=1" align="middle" width="425" height="344" >
<param name="movie" value="http://www.youtube.com/v/FrYlNNy929Y&hl=en&fs=1" />
<param name="allowFullScreen" value="true"></param>
<param name="allowScriptAccess" value="sameDomain" />
<embed src="http://www.youtube.com/v/FrYlNNy929Y&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>
</object>

The way they do it now is to have a very bare outer OBJECT tag and then some PARAMS and an EMBED tag. Rather than reference the movie source in the OBJECT's data attribute its only referenced in the PARAM and EMBED tags.
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/FrYlNNy929Y&hl=en&fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/FrYlNNy929Y&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>
</object>

Now I know there are a multitude of ways of delivering movie content on the web and you can deliver it server-side or client-side with one of the libraries such as SWFObject or UFO or the new combination of those two and Adobe SWFObject 2.

I tend to do my delivering server-side mainly for the reason that at least 10% of users have Javascript disabled when they surf the web therefore that is quite a large audience to skip over. To keep to standard XHTML I was going down the route of copying what the Javascript libraries do but server-side e.g
  • Check for browser type e.g IE, a known standard compliant browser or Unknown
  • For IE deliver the OBJECT method with classid and codebase
  • For non IE deliver the OBJECT method with type application/x-shockwave-flash
  • For unknown deliver the nested method OBJECT and EMBED
  • Load some Javascript to handle the EOLAS patent issue for Opera (IE has fixed this)
Therefore we keep to the standards and get maximum audience coverage. For users of Opera with Javascript enabled they will play normally but those without they will have to click them to play. Although an annoyance this is a smaller percentage than the 10% who would have no flash play due to Noscript being enabled etc.

Another introduction to the current myriad of ways to deliver movie content is the new VIDEO tag which is now being supported by Firefox 3.5, SeaMonkey 2, Thunderbird 3 and Chrome 3. Currently it supports limited filetypes such as Ogg Theora which is an open format and you can reference a movie pretty simply which the following syntax shows.
<video id="video6" src="http://www.dailymotion.com/cdn/OGG-320x240/video/x9euyb?auth=1269605698_a8b629faf0d043e1b538971997ff9ba5" width="425" height="344"></video>

Accessing video content through Javascript

If you are loading all your video content through Javascript which a lot of people do then although you may be missing 10% of your audience you won't have to worry about the EOLAS issue in Opera and you will have a variety of functions in your chosen library to access the movie and manipulate it.

However if you are loading your flash server side like me you still may need some Javascript functionality to access the movie and check whether it has loaded or not.

The following code contains two functions which can be used to access a movie delivered by an OBJECT, EMBED or VIDEO tag cross browser and should handle very old browsers as well as it has an extensive fallback.

The other function lets you check whether a movie has loaded yet which you may want to do before making controls available to manipulate the movie or as I do with my flash bullet counter starting the movie and moving it to a certain frame.

function getMovie(movie){      
var r = null;
// try for standards way of accessing movie through OBJECT tag if you use the new ADOBE/SWFObject JS library
// to create your flash then this will work.
var o = document.getElementById(movie);
if(o){
if (o.nodeName == "OBJECT") {
// check SetVariable this could return undefined, unknown or function depending on browser
if (typeof o.SetVariable != "undefined") {
r = o;
}else{
var n = o.getElementsByTagName("object")[0];
if (n) r = n;
}
// handle the new VIDEO tag which plays Ogg files and can handle multiple fallbacks
}else if(o.nodeName == "VIDEO"){
r = o;
}
}
// if we still have no flash movie revert back to old tried and tested methods.
// these are used when you deliver your flash server sides in certain browsers
if(!r){
// access the window or document object
r = (document[movie]) ? document[movie] : window[movie];
if(r) return r;

// last resort use the embeds collection
if(document.embeds){
r = document.embeds[movie];
}
}
// return either null or a reference to our movie
return r;
}

// function to test whether a movie has loaded yet
function isMovieActive(movie){
movie = typeof(movie)=="string" ? getMovie(movie) : movie;
// if we have no reference quit
if(!movie) return false;

// default our percent loaded variable to 0 = not loaded
var pl=0;

// for VIDEO tags we can check the readyState property https://developer.mozilla.org/En/nsIDOMHTMLMediaElement
// readyState 3 video can be played a bit
// readyState 4 video can be played to the end without interuption
if(movie.nodeName=="VIDEO"){
return (movie.readyState>=3) ? true : false;
}else{
//if movie not loaded then this will raise an error but if its loaded we can check the PercentLoaded property
try{
pl=movie.PercentLoaded();
}catch(e){}
return (pl==100) ? true : false;
}
}

The following test page has been created to show all the numerous methods of outputting OBJECT and EMBED tags with a test to show which Javascript methods allow access of the movie. Test it in various browsers to see the differences and when viewing in Chrome be prepared to wait a while for the VIDEO content to load which will give you a chance to see the isMovieActive function work both ways. Also the movie is pretty funny anyway so its worth watching as its a fight between a Yoga master and two kung fu fighters.