androidcastingandroid-tvnetflix

Cast Netflix video to TV, without Netflix account on it


I'm developing a TV App in android, which need to cast a video on TV netflix, but I have to do that without logged account on netflix tv app. Is it possible?


Solution

  • After digging deep on stackoverflow I found a ticket that solve my problem: Movie Deeplink for Netflix Android TV app (com.netflix.ninja) Congrats for @Jeroen Ost that post the solution.

    I still had to work with netflix version. The one that worked for me was ninja 3.3.1. BE AWARE.

    Bellow the class that cast any kind of link that has share on the third party aplication.

    public void openUrl(String url){
    
                Pattern p = Pattern.compile("www[.]netflix.*?[0-9]+");
    
                Matcher matcher = p.matcher(url);
                Intent webIntent = new Intent(Intent.ACTION_VIEW);
                if(matcher.find()){
                    url = matcher.group();
                    url = url.replace("title", "watch");
                    url="http://"+url;
    
                    webIntent.putExtra("source","30"); // careful: String, not int
        //            netflix.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);
                }
                webIntent.setData(Uri.parse(url));
                webIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                Log.i(TAG,"Cast URL: "+url);
                try {
                    startActivity(webIntent);
                } catch (ActivityNotFoundException ex) {
                    Log.i(TAG, "can't start Activity");
                    Log.e(TAG, ex.getMessage());
                }
    
    
            }