Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Android open youtube in fullscreen mode

Hi,

I am developing an app for Android using Titanium SDK 1.7.3, and Android 2.2 and 3.0.

I need to show a video in Youtube. Since we cant open the youtube video in the app,like in iOS, I found out how to open it in the youtube app. (If anyone needs that code, I will be happy to help you). I am doing this using an Intent to open the youtube app. Which is all very great!

But the client now wants it in full screen mode in the youtube app - which you can do if you click on the button in the youtube app. But they want the app to launch the app in full screen mode.

Makes sense, so the user doesnt start clicking other links on the youtube app, and go away from our app.

Does anyone know how to do that?

Thanks!

— asked November 18th 2011 by Sridevi Kolluri
  • android
  • fullscreen
  • titanium
  • youtube
1 Comment
  • Can you please share you code to open the youtube video?

    — commented April 5th 2012 by Umar Hadyatullah

1 Answer

  • Hi,

    I am not so sure on this solution but you can try, For this you have to make change in the android manifest file. The activity corresponding to the video intent just add this below line in it.

    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

    and check that it works or not.

    Regards

    Nikunj

    — answered November 19th 2011 by Nikunj Sakhrelia
    permalink
    4 Comments
    • Thanks for the reply, Nikunj!

      I am not making a new activity for this intent. Just adding it to current activity -

      Ti.Android.currentActivity.startActivity(intent);

      Where can I add the style then? Can I add soemthing to the intent?

      This is my code in brief-

      var intent = Ti.Android.createIntent({
                      action: Ti.Android.ACTION_VIEW,                
                      data: 'vnd.youtube:' + appFile
                         });
                   Ti.Android.currentActivity.startActivity(intent);
      //
      

      — commented November 19th 2011 by Sridevi Kolluri
    • i would suggest to add this inside the android manifest file with the current activity

      — commented November 20th 2011 by Nikunj Sakhrelia
    • Well, the problem is that I am using Titanium for development. So, there is no android manifest file. It is integrated with Tiapp.xml.

      I declare one activity

       <application>
                      <!--android:icon ="Icon-72@2x.png" android:label="XX" -->
                      <activity android:alwaysRetainTaskState="true"
                          android:configChanges="keyboardHidden|orientation"
                          android:label="XXAndroid"
                          android:name=".activity.XXAndroidActivity" android:theme="@style/Theme.Titanium">
                          <intent-filter>
                              <action android:name="android.intent.action.MAIN"/>
                              <category android:name="android.intent.category.LAUNCHER"/>
                          </intent-filter>
                      </activity>
      
                  </application>
      

      So, I dont know where to add the style.theme for fullscreen?

      — commented November 20th 2011 by Sridevi Kolluri
    • Anyone know how to open youtube in full screen mode, if I am opening it in youtube app uysing an intent?

      The code is in the previous comments.

      Thanks! Would appreciate an answer.I am on a tight deadline end of week, and I am far behind :-(

      Thanks,
      Sri

      — commented November 21st 2011 by Sridevi Kolluri
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.