Javascript, Smartphone detection for videos? - javascript

If there's a better way I am all for it. But I wanna detect a smartphone user on my site.
Whether they be a webOS, Android, or iPhone OS phone. I have a flash video on my site, but when I detect a smartphone users I want it to be a HTML5 video on the site instead.

You could try using this js library: http://videojs.com/

Here is a link to a javascript fix that I used in a similar situation. It not so much detects devices such as smart phones, rather detects whether the user has is able to view flash or not, displaying flash content first and falling back with whatever you specify if flash is not installed.
http://www.featureblend.com/javascript-flash-detection-library.html
Really simple to use and it played nicely with jQuery when I used it.
-Paul

Related

How to enable the swf file autoplay on the mobile version of wordpress

I embedded the swf file on my wp page.(https://www.pacifictintlv.com/mobile).
But when viewing on mobile, it doesn`t work.
Can we just fix it so that it will automatically forward them to the Flash download link in case they don't have Flash enabled/installed or is there another fix for this?
There is no Flash download link. Flash hasn't been supported on Android for over five years and has famously never been supported on iPhone. Flash itself will reach end of life in 2020. There are ways for users to run Flash if they really want to, but it's too much to expect the average visitor to jump through those hoops.
Why are you using Flash at all? That page could easily be implemented with Javascript, and be far more accessible in the process.

HTML5 audio/javascript stops working on android(google chrome) when screen is turned off

I have created a Web App which plays music playlist and it works well on desktop browsers and also in mozilla and opera of android. But When I play the songs on Chrome browser of Android and I turn off the screen, it stops after playing the current song. And as soon as I turn the screen on, it starts loading the next song in line.
From my observations, what I have understood is Google Chrome browser on android pauses the javascript code from executing if the screen is turned off till the screen is not waken up again. Is there any way I can prevent my specific library from pausing? Any approach or events?
Some related this question is what I am looking for: JavaScript halts in inactive android Chrome tab
There are so many WebApps which does not stop playing music. Does it need some permissions from Google App Store?
check what happens with youtube, at least few years ago i had an awful time dealing with that and that's what proved to my client it cant be done in the given time frame and budget. that was actually device specific, on some devices it worked fine and on others it didnt. check if it happens on other devices. the only solutions i could think of ware either to prevent screen turn off (on problematic devices or all of them at the beginning), or to build an app and handle onPause event
I don't think that you can change the behaviour of the Chrome app, if they want to save battery in the background and stop the javascript, you won't reactivate it.
There are maybe some other ways to get it working.
Tell your users that they should use Firefox or Opera on their mobile device.
All apps are allowed to play or stream music in the background, so you could make or use an app for your task.
Maybe you can use the default music player app on android. Open a playlist of streams using the app. (I don't know if this is possible, because I have no android device.)
I know that is not exactly what you want, but a maybe a way to get it working.

Detect if the UIWebView can play video inline on iPhone ( allowsInlineMediaPlayback )

I am trying to tell if my video is going to play inline once the user starts the video (as apposed to fullscreen/in the native video player) on an iPhone in a UIWebView before the video has started. I have no way of knowing if the UIWebView has the setting allowsInlineMediaPlayback = YES as i do not know in what app or on what page my video is being displayed.
My goal is to only show the video if it can be played inline.
Is there any way to read the allowsInlineMediaPlayback setting from javascript, or detect if my video will play inline or not?
Everything I have read on the apple developers website seems to suggest that it will automatically play in full screen mode in safari. Now if they are using another app, as far as I know you do not have access to that apps UIWebViews properties. However, in an attempt to not be totally useless, here is a link to all of the methods you can query and you might find some useful information in there.
https://developer.apple.com/library/safari/documentation/AudioVideo/Reference/HTMLMediaElementClassReference/HTMLMediaElement/HTMLMediaElement.html#//apple_ref/doc/uid/TP40009355-CH18-SW27
Some more information that may be useful to you.
https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/AudioandVideoTagBasics/AudioandVideoTagBasics.html#//apple_ref/doc/uid/TP40009523-CH2-SW1

Liveweb Plugin for Powerpoint: Support for HTML5 Canvas?

I'm thinking of using the Liveweb plugin for Powerpoint, to embed a web page in a Powerpoint presentation.
Does Liveweb support HTML5 Canvas? Does it support Javascript?
Thanks very much in advance to all for any info.
Shyam Pillai's LiveWeb? It simply embeds an instance of the browser control into your presentation. It doesn't support any web technologies ... just turns the browser loose on them, so it'll depend on the MSIE version in place and what it supports and your Internet settings (ie, whether javascript is disabled or not).
Or the short version: Can't answer that. Try it for yourself and see. ;-)
So far it doesn't seem to be working. I can access a web page from inside a PowerPoint slide show. I can use the navigation on the page and navigate around the site. But when I go to a page that uses HTML5 Canvas, the Canvas objects don't yet appear.

how to keep track of play and pause events on an embedded blackberry media player on a website?

I'm using an embedded media player on my website to allow blackberry users to listen to audio without having to download it. (I'm testing this on blackberry bold 9700 and so any cool html5, flash or embed tags wont work) The reason I have it embedded is because I want to be able to keep track of a users listening time.
Basically what I want is to be able to know when a user clicks play or pause. How do I gain control of these buttons? possibly using some jquery?
This is my code for the player:
<object data="myfilepathHere" type="audio/mpeg">embedded track isnt working!</object>
This is the site I used as a reference:
http://devblog.blackberry.com/2009/08/blackberry-browser-embedded-media-content-automatic-playback-how-to/
I can get the two buttons play/pause and stop to show up (and it looks just like it does in the link I've provided) on the blackberry and the track to play so if I can get this to work that would be just dandy. thanks! :D
Sorry, I spent some time trying some ideas out and I'm pretty certain it's not possible to track or listen to any events on the Object. You really need the Audio tag on BBOS 6.0 and higher. If you were doing a WebWorks app instead of a website we have an API that would help (https://developer.blackberry.com/html5/apis/blackberry.audio.player.html).
Supporting 6.0+ is not that bad. You may find that the majority of people who visit your site have that version or higher.

Categories