Play DRM encrypted video stream with "pure" Java - java

I am investigating whether is it possible (I am sure it is, I mean simple way) to build a Java-based client desktop App to play DRM protected video stream.
DRM: DASH CENC DRM1, PlayReady, Widevine Classic\Modular, FairPlay.
VLCJ supports the input-from-memory feature to implement custom protocols or DRM but it looks like a painful digging into DRM specifications.
There is a Node.js open-source project DOWNstream for Electron which can help with Widevine DRM.
The article describes Java and Electron integration (source) but I guess it is accidental complexity in this case.
Previously I didn't face with video-streaming domain and I wouldn't like to reinvent the wheel so my questions are:
It seems that there are no "pure" Java implementations. Why? Because of format wars? security issues?
Do you happen to know any simple way (DalvikVM supports Widevine out of the box) to create App without involving "browser techs" like JS?
Thank you. I would appreciate hearing your thoughts.

I think looking at how the DRM's are provided on platforms may help you understand the options and let you think about how you want to approach your solution.
The DRM client functionality, i.e. the DRM functionality which resides on a phone or tablet or laptop etc as opposed to the DRM server side functionality, is generally built in by the device or OS vendor when it the device or OS is being produced/manufactured. For some DRM's on some devices it is also possible to add it via a SDK.
Most DRM's are used via 'native' players in mobile devices and tablets and via the browser on PC's, laptops etc so this is the usual default that you can generally rely on to be supported. Smart TV's and games consoles are more varied and can be either via browser or native depending not he device.
Recently, nearly all mobile and tablet browsers have added support for browser based DRM also, but many DRM's on laptops are restricted to the browser, or more specifically the CDM (Content Decryption Module) browser add on which is DRM specific.
There are DRM's which are supported outside the browser on PC's and laptops - for example Windows based devices will generally support PlayReady DRM in a way that can be accessed by applications. Microsoft provide more infomrtaiopn on this here:
https://learn.microsoft.com/en-us/playready/overview/developing-applications
There is a nice diagram which summarises different devices at the above link which I've copied below also as it helps explain:
I am not aware of a similar Widevine or FairPlay support on PC's or laptops although ones may exist or be in development.
So, going back to your problem, the reason that most cross platform applications use Javascript and browser technology for DRM on laptops and PC's is not really a language issue, rather it is because via the browser is the only way to access the DRM functionality on some laptops and PC's.
For Windows you have the option to use the Universal Windows Platform API but this still may not give you want you are looking for and is Windows and PlayReady specific.

Related

Iphone Application Porting to Blackberry RIM

I have developed an application for iPhone. Is there any way to port that application on to Blackberry RIM so that i can avoid rewriting the application in Java for Blackberry RIM?
I am rewriting my application for black berry,suggest me the way to rewrite so that later stage I can port that directly to Android.
Thanks in advance.
The short answer is no.
The closest thing I am aware of is projects like PhoneGap (and others, including Appcelerator Titanium) which allow for cross platform development for smart phones including iPhone, Android, and Blackberry by creating hardware specific wrappers around WebApps. PhoneGap essentially allows for Web Apps to have more complete access to the hardware and operating system of these devices (like the camera, motion detection, push notification, etc.) by wrapping the Web App in a customized browser that provides javascript handles for accessing the hardware.
PhoneGap will even build binaries for each of the supported platforms on their servers (with limitations...for example, if you want to submit to the Apple App Store, you currently need to build the iPhone binary yourself due to developer certificate issues).
So if your app could be (re)conceived as a Web App with some extra help accessing device specific hardward features, then PhoneGap or similar development kits might provide some shortcuts to cross platform deployment.
not really. If your app is written in custom objective-c code, then you will need to manually port it to blackberry java. there are some cross-platform app frameworks out there though that may allow you to do what you need, but youd have to redevelop your app with those frameworks.

What environment is more portable QT or java and which do you suggest using for my application needs?

I want to wrap a website and create an application around it (kind of like the iPhone/iPod Facebook app) and i want the application to be as portable as possible so with a very few modification to the code it can run on pc, mac, iPod, android or any other.
I know that Java is known for it's portability but i dislike it and i don't know about QT.
I know this question is quite subjective but can you give me a couple of opinions and reasons for them any way?
Thanks in advance,
Dante
Qt is portable enough for the major platforms (Windows, Linux and MacOS). It has the advantage of being native code, so no virtual machine is needed. And it provides rich graphics and other powerfull features, and the GUI look and feel of the specific platform.
If you are considering the same code base to be shared between desktop and mobile platforms, think again. There are different constraints in terms of resources, screen dimensions, etc. Qt can be used for some mobile platforms (mainly Symbian, Maemoo), Java for Android and ObjectiveC/C++ for iPhone/iPod. So a cross mobile platform application using the same technology is not feasible (at least for the moment).

Is it worth studying applet?

I am a fresher in web developing , is I ve to study applets?
If you are a Java person, maybe look at JavaFX instead (even though it is not clear yet if that technology will take off any more than applets did).
If you are a web design person, do not even think about it before you got acquainted with Flash and HTML5. Applets are quite marginal at this point.
Most folks say no, but I still see a lot of great uses for Applets and in fact have seen really complex commercial UIs coded within the context of an applet.
in a short word, no, applets are a dead technology for the general purpose web.
on intranets with lots of bandwith and controlled client environments they maybe of some valid use.
look at Google Web Toolkit (GWT) as an alternative to creating applets.
Adobe Flex is also a good alternative now.
If you want an embedded client application, the Java Web Start (the better Google keyword is JNLP) is less or more the successor of the legacy Java Applet. Alternatives to this are Adobe Flash and MS ClickOnce.
If you want an RIA (Rich Internet Application), then JavaFX is the better Java based choice. Alternatives to this are the MS SilverLight, Adobe Air and Adobe Flex.
Apart from JavaFX, Flash, you can learn about Adobe AIR and Microsoft Silverlight. They are kind of extending the limits of what was earlier possible with just Flash
There is still one thing that I know of that a Java applet can do and Silverlight, Flex (non-AIR), etc can't do:
Drag and drop from the filesystem.
Flex offers a o/s based browse and select filesystem access. Silverlight has a similar functionality. But to the best of my knowledge if you want the user to drag a file from Windows Explorer etc. into a web-site based control, Java applets are pretty much your only choice. You could create a Flex based app using Adobe AIR that can ask the filesystem outside the o/s browse and select dialog but I'm not convinced the AIR install base is adequate yet. Probably depends on your target customer (early adopter, install whatever you say to vs. stable corporate user with IT lockdown on their workstation).
If someone knows otherwise for certain, please comment!
But to answer the original question, unless you need the drag and drop filesystem to web functionality, I would spend your time on Flex. Silverlight and Java FX can't compete with Flash for market penetration. Since Flex compiles to flash, it has a very high install base (>95% of internet enabled computers) and its base updates to the newest version frequently. Inserting a flash file into a browser is a easier than the arcane art of applets.
if you want/might get a job where you maintain old applications then probably you will deal with Applets.
For new projects, dont get close to it.

How to communicate with a USB device under Windows and Java?

I'd like to communicate with a USB device under Windows and Java but I can't find a good library to do so. I don't want the user to have to install any extra hardware or device drivers to make this work. That is, I want to be able to interact with USB just like other Windows applications do.
I am familiar with jUSB and JSR 80 but both seem to be dead projects (at least for Windows).
libusb-win32 requires you to install their generic driver, which then makes a USB device available to you. I'm not sure that it's possible to do driver-less access of an USB device unless the device belongs to one of several standard classes (storage and HID, in particular).
There is a Java wrapper for libusb-win32 which might work for you. I haven't used it myself, though.
I did quite a bit of research on this some time ago, and the unfortunate fact was that all the useful free USB+Windows+Java projects were dead. There is commercial and expensive (price $39.99 is not per developer, but per copy of your software sold!) JCommUSB library which probably works, although I have no experience of it; we had to build our own custom C wrappers to the USB drivers and communicate with them through JNI.
The fastest and easiest way is to hack some native code :)
I wrote a small wrapper for HID devices that enabled my Java applications to read data from CalComp digitizers, so it's definitely doable and not too hard. The bad thing is that my work is still proprietary code owned by my former employer, so for legal reasons I can't release that as open-source -- yet.
The good thing is that you can get a flying start with the HID example code from the Microsoft DDK :)
Communication between Windows and a USB device by java.
http://javausbapi.blogspot.com/2010/05/java-usb-api.html
An example is conducted for a Freescale microcontroller

Is Java the best language for Mobile App Devlopment?

I was wondering what are the benefits of using anything else but Java for Mobile Application Development.
I do think that yes, Java is the most common language for devices, with two exceptions:
Windows mobile applications, that are frequently built in C++ but that will be built more on the .NET framework in the future.
iPhone applications, that use Cocoa and Objective-C.
Java is the most ubiquitous and for that alone it is your best choice.
You have to use whatever the phone vendor(s) that you intend to support will provide. As most provide Java, but only some provide other things, if you want to support a range of handsets, you probably need to use Java for at least some of them.
Your client (be they internal or external) will need to decide what handsets to support, and you then need to base your decision on supported handsets.
It's not entirely impossible that you'll have to ship versions in different programming languages, which may make code reuse more "challenging". It all depends on your requirements. Nobody on this site can tell you what they are :)
It really depends on what you're trying to do.
Java, whilst ubiqutious does have speed disadvantages. Also it's not "write once, run anywhere" as it is on the desktop space, as different manufactureres, even different devices have different sub-sets of java installed each with differening inclusions of APIs.
Using native code is going to be more efficient, whilst more difficult to port. It provides a more direct representation of the devices capabilities without the sandboxing of a VMs Apis.
Alternatively, you could use a language like C which whilst isn't strictly portable, will have implemenations on many devices with minor tweaks to make, whilst retaining a lot of the speed beenifts of such a language. (OpenC on S60/Symbian), C on Palm etc.
It depends on what you see as the future of the the mobile space. If the iPhone turns out to be as popular as the iPod, then no, Java probably wouldn't be the best choice.
One thing to consider is that at some point there may no longer be such thing as an iPod Nano, perhaps the Touch will be the only iPod available. In that case, every single iPod out would support Apple's iPhone OS and the number of iPhone OS mobile devices would far exceed those of Java.
Five years from now perhaps "Cocoa vs. Android" will be the new Mac vs. PC. In that case, Java could be just as good as Cocoa.
The only reason I can think of is that you wouldn't need a Java runtime on the target device.
Palm, for instance, allows you to code in C and talk directly to the OS routines in ROM. The C code compiles directly to the machine language without needing a runtime.
before one can provide a speculative answer to such a trivial question there are other variables that need be answered. What kind of phone application does one want to develop.
e.g. you can use xhtml for something that does not need to connect to the phones' core features.
and when you need to connect to the phone software or hardware you have can use java,python,c++,windows mobile or the new kid on the block android.
Java is the best if you want to support multiple phones, however J2ME is a limited environment. If you are doing homebrew development then develop for whatever your own phone uses, for commercial development then Java is the most widespread (and there are companies that can port Java to other platforms).
One of the advantages of using native code is your are closer to the hardware, on a mobile phone this means you might be able to take advantage of features which are not exposed to the virtual machine upon which your Java application is running, the promise of Android is that everything is a lot more exposed that it is with a typical Java Mobile implementation
Best is to go to nokia, apple microsoft or google web sites or whaterver and see what developer tools and resources are available and choose the one you want to develop for all of them are very good as good mobile app developers can help increase their market share.
Depends on what Application you are trying to write.
If its a simple service / data provider I would use HTML and CSS via a framework like
jqTouch, jQuery Mobile, or http://www.sencha.com/ as these will run on mostsmart phones and you can package them into a binary app using something like http://www.phonegap.com/ this will allow for sliding, GPS, local file storage using HTML5
If you need to a database, motion sensing, bluetooth, game type application then you could look at
http://monotouch.net/
http://monodroid.net/
That lets you write c# .net code and deploy onto any platform do you should be covered for windows mobile, android and iPhone.
There is also http://rhomobile.com/ that lets you write applications for all mobile platforms using Ruby.

Categories