castdemo/src/main/java/com/vdocipher/sampleapp/castdemo/MainActivity.java
/**
     * Fetch (otp + playbackInfo) and initialize VdoPlayer
     * here we're fetching a sample (otp + playbackInfo)
     * TODO you need to generate/fetch (otp + playbackInfo) OR (signature + playbackInfo) for the
     * video you wish to play
     */
Fetch (otp + playbackInfo) and initialize VdoPlayer
here we're fetching a sample (otp + playbackInfo)
TODO you need to generate/fetch (otp + playbackInfo) OR (signature + playbackInfo) for the
video you wish to play
Fetch ( otp + playbackInfo ) and initialize VdoPlayer here we ' re fetching a sample ( otp + playbackInfo ) TODO you need to generate / fetch ( otp + playbackInfo ) OR ( signature + playbackInfo ) for the video you wish to play
private void obtainOtpAndPlaybackInfo() {
        Log.i(TAG, "fetching params...");
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Pair<String, String> pair = Utils.getSampleOtpAndPlaybackInfo();
                    String otp = pair.first;
                    String playbackInfo = pair.second;
                    initParams = new VdoInitParams.Builder()
                            .setOtp(otp)
                            .setPlaybackInfo(playbackInfo)
                            .setPreferredCaptionsLanguage("en")
                            .build();
                    Log.i(TAG, "obtained new otp and playbackInfo");
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            loadInfo.setText(R.string.load_done_msg);
                            playerButton.setEnabled(true);
                            playerButton.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    loadPlayerActivity();
                                }
                            });
                        }
                    });
                } catch (IOException | JSONException e) {
                    e.printStackTrace();
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(MainActivity.this,
                                    "Error fetching otp and playbackInfo: " + e.getClass().getSimpleName(),
                                    Toast.LENGTH_LONG).show();
                            Log.e(TAG, "error fetching otp and playbackInfo");
                            loadInfo.setText(R.string.load_error_msg);
                            loadInfo.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    obtainOtpAndPlaybackInfo();
                                    loadInfo.setOnClickListener(null);
                                }
                            });
                        }
                    });
                }
            }
        }).start();
    }
private void obtainOtpAndPlaybackInfo ( ) { Log . i ( TAG , "fetching params..." ) ; new Thread ( new Runnable ( ) { @ Override public void run ( ) { try { Pair < String , String > pair = Utils . getSampleOtpAndPlaybackInfo ( ) ; String otp = pair . first ; String playbackInfo = pair . second ; initParams = new VdoInitParams . Builder ( ) . setOtp ( otp ) . setPlaybackInfo ( playbackInfo ) . setPreferredCaptionsLanguage ( "en" ) . build ( ) ; Log . i ( TAG , "obtained new otp and playbackInfo" ) ; runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { loadInfo . setText ( R . string . load_done_msg ) ; playerButton . setEnabled ( true ) ; playerButton . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { loadPlayerActivity ( ) ; } } ) ; } } ) ; } catch ( IOException | JSONException e ) { e . printStackTrace ( ) ; runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { Toast . makeText ( MainActivity . this , "Error fetching otp and playbackInfo: " + e . getClass ( ) . getSimpleName ( ) , Toast . LENGTH_LONG ) . show ( ) ; Log . e ( TAG , "error fetching otp and playbackInfo" ) ; loadInfo . setText ( R . string . load_error_msg ) ; loadInfo . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { obtainOtpAndPlaybackInfo ( ) ; loadInfo . setOnClickListener ( null ) ; } } ) ; } } ) ; } } } ) . start ( ) ; }
Fetch (otp + playbackInfo) and initialize VdoPlayer
 here we're fetching a sample (otp + playbackInfo)
 TODO you need to generate/fetch (otp + playbackInfo) OR (signature + playbackInfo) for the
 video you wish to play
Fetch ( otp + playbackInfo ) and initialize VdoPlayer here we ' re fetching a sample ( otp + playbackInfo ) TODO you need to generate / fetch ( otp + playbackInfo ) OR ( signature + playbackInfo ) for the video you wish to play
// todo use asynctask