Skip to content Skip to sidebar Skip to footer

Starting Vitamio In A Service From Cordova Plugin

After about a week...I thinks it's time to ask the SO community :) Now I already have a working(work in progress) plugin that already does this. java file that extends CordovaPlugi

Solution 1:

Wow. Can't believe I missed this in the logs.

I did not declare the necessary string resources that are used by vitamio's initialization methods :/ ..located in res/values/strings.xml ...everything working normally now.

So in short if you are using Cordova do this..

  1. Add the vitamio init to your MainActivity should look like this

    import io.vov.vitamio.LibsChecker; //don't forget to import this!

    publicclassMainActivityextendsCordovaActivity
      {
          @OverridepublicvoidonCreate(Bundle savedInstanceState)
          {
              super.onCreate(savedInstanceState);
              if (!LibsChecker.checkVitamioLibs(this))
              return;
                  // Set by <content src="index.html" /> in config.xml
                  loadUrl(launchUrl);
           }
      }
    
  2. Ensure that you have all string references in your plugin.xml like so

    <config-filetarget="res/values/strings.xml"parent="/resources"><stringname="vitamio_library_app_name">VitamioLibrary</string><stringname="vitamio_init_decoders">Initializing decoders…</string><stringname="permission_group_tools_label">Vitamio tools</string><stringname="permission_group_tools_description">Access Vitamio package and resources.</string><stringname="permission_receive_messages_label">Receive Vitamio messages</string><stringname="permission_receive_messages_description">Receive all broadcasts from Vitamio service.</string><stringname="permission_write_providers_label">Write Vitamio providers</string><stringname="permission_write_providers_description">Delete, update or create new items in Vitamio providers.</string><stringname="VideoView_error_title">Cannot play video</string><stringname="VideoView_error_text_invalid_progressive_playback">Sorry, this video is not valid for streaming to this device.</string><stringname="VideoView_error_text_unknown">Sorry, this video cannot be played.</string><stringname="VideoView_error_button">OK</string><stringname="mediacontroller_play_pause">Play/Pause</string></config-file>
  3. In your android manifest...

    <activityandroid:name="io.vov.vitamio.activity.InitActivity"android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden"android:launchMode="singleTop"android:theme="@android:style/Theme.NoTitleBar"android:windowSoftInputMode="stateAlwaysHidden"/><activityandroid:configChanges="orientation|keyboardHidden|navigation"android:launchMode="singleTop"android:name="io.vov.vitamio.activity.InitActivity"android:theme="@android:style/Theme.NoDisplay"android:windowSoftInputMode="stateAlwaysHidden" />

You should now be able to use the vitamio Media class like normal. At some point I'm going to write a tutorial on this to save people from going crazy :}

btw obviously make sure you have the vitamio lib installed as well you could look at https://github.com/nchutchind/Vitamio-Cordova-Plugin to see how he did it...thats what I did. Great plugin btw.

Post a Comment for "Starting Vitamio In A Service From Cordova Plugin"