fgl27 / SmartTwitchTV

A Twitch web client that works on Android TVs and web base systems
GNU General Public License v3.0
366 stars 28 forks source link

Implement VIEW intent handling #160

Open vivithecanine opened 1 year ago

vivithecanine commented 1 year ago

Please describe the feature. It would be helpful to be able to tune to specific streams or videos via ADB. Similar to issue #159.

For example, STube can handle urls like this:

adb shell am start -a android.intent.action.VIEW -n com.teamsmart.videomanager.tv/com.liskovsoft.smartyoutubetv2.tv.ui.main.SplashActivity -d "https://youtube.com/watch?v=dQw4w9WgXcQ"

This would require an intent-filter like the following:

<action android:name="android.intent.action.VIEW"/>

As well as some kind of Intent Processor

fgl27 commented 1 year ago

The app has a method to deal with intent, technically any that arrives included if those you propose are added must pass by this, but I have tested it.

https://github.com/fgl27/SmartTwitchTV/blob/73d63269f5d252e66ddd28487c83ffa990e99bad/apk/app/src/main/java/com/fgl27/twitch/PlayerActivity.java#L321-L325

Then we can retrieve the intent, save or do something with it.

https://github.com/fgl27/SmartTwitchTV/blob/73d63269f5d252e66ddd28487c83ffa990e99bad/apk/app/src/main/java/com/fgl27/twitch/PlayerActivity.java#L1505

and then we can send it to the front end as done here.

https://github.com/fgl27/SmartTwitchTV/blob/73d63269f5d252e66ddd28487c83ffa990e99bad/apk/app/src/main/java/com/fgl27/twitch/PlayerActivity.java#L1545

Technically is better to add a method that checks the URL in the front end as the URL may change and changing the front end of this app is much easier, as doesn't require pushing a play store update.

Thanks for sharing the proper explanation of how to test this it helps a lot, will add this in the future.