From: <kro...@us...> - 2011-01-13 21:02:17
|
Revision: 4070 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4070&view=rev Author: kroko_koenig Date: 2011-01-13 21:02:08 +0000 (Thu, 13 Jan 2011) Log Message: ----------- split the code into diff sections, add vlc interop Modified Paths: -------------- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/AndroidManifest.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/readme trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/player.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote01.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MediaPlayerControl.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/communication/SendCommand.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures/Picturesfullscreen.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/utils/AppSettings.java trunk/plugins/AndroidRemote/Release/AndroidRemote.xmp2 trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.Designer.cs trunk/plugins/AndroidRemote/Server/AndroidRemote/Setup.cs trunk/plugins/AndroidRemote/Server/AndroidRemote.suo Added Paths: ----------- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/webradio.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/multimedia/ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/multimedia/AudioPlayer.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/multimedia/Webradio.java trunk/plugins/AndroidRemote/Server/AndroidRemote/Content/ trunk/plugins/AndroidRemote/Server/AndroidRemote/Content/ExecuteCommand.cs trunk/plugins/AndroidRemote/Server/AndroidRemote/Content/MusicHandler.cs trunk/plugins/AndroidRemote/Server/AndroidRemote/Content/NowPlayingHandler.cs trunk/plugins/AndroidRemote/Server/AndroidRemote/Content/PictureHandler.cs trunk/plugins/AndroidRemote/Server/AndroidRemote/Content/SomeUtils.cs trunk/plugins/AndroidRemote/Server/AndroidRemote/SocketHandler.cs Removed Paths: ------------- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/StreamingMediaPlayer.java trunk/plugins/AndroidRemote/Server/AndroidRemote/ExecuteCommand.cs Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/AndroidManifest.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/AndroidManifest.xml 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/AndroidManifest.xml 2011-01-13 21:02:08 UTC (rev 4070) @@ -2,7 +2,11 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mediaportal.remote" android:versionCode="1" android:versionName="1.0"> - <application android:icon="@drawable/icon" android:theme="@android:style/Theme.NoTitleBar" android:debuggable="true"> + <application android:icon="@drawable/icon" + + android:theme="@android:style/Theme.NoTitleBar" + android:debuggable="true" + android:label="MediaPortal Remote"> <activity android:label="@string/app_name" android:launchMode="singleInstance" android:name=".Main"> <intent-filter> @@ -25,6 +29,7 @@ <activity android:launchMode="singleInstance" android:name=".music.MusicSong"></activity> <activity android:launchMode="singleInstance" android:name=".music.MusicTab"></activity> <activity android:launchMode="singleInstance" android:name=".music.MusicResults"></activity> + <activity android:launchMode="singleInstance" android:name=".multimedia.Webradio"></activity> <activity android:name=".MediaPlayerControl" android:launchMode="singleInstance"></activity> </application> <uses-sdk android:minSdkVersion="3" /> Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java 2011-01-13 21:02:08 UTC (rev 4070) @@ -85,32 +85,33 @@ public static final class id { public static final int GridView01=0x7f070017; public static final int ImageView01=0x7f070019; - public static final int LinearLayout00=0x7f070056; - public static final int LinearLayout01=0x7f07001e; - public static final int LinearLayout02=0x7f070061; - public static final int LinearLayout03=0x7f07006b; - public static final int LinearLayout04=0x7f070075; - public static final int LinearLayout05=0x7f07007b; - public static final int ListView01=0x7f07002c; - public static final int Spinner01=0x7f070089; + public static final int LinearLayout00=0x7f070058; + public static final int LinearLayout01=0x7f070020; + public static final int LinearLayout02=0x7f070063; + public static final int LinearLayout03=0x7f07006d; + public static final int LinearLayout04=0x7f070077; + public static final int LinearLayout05=0x7f07007d; + public static final int ListView01=0x7f07002e; + public static final int Spinner01=0x7f07008b; + public static final int SurfaceView01=0x7f07001f; public static final int TableLayout01=0x7f070005; - public static final int TableLayout02=0x7f07003b; + public static final int TableLayout02=0x7f07003d; public static final int TableRow01=0x7f070006; - public static final int TableRow02=0x7f070040; - public static final int TableRow03=0x7f070045; + public static final int TableRow02=0x7f070042; + public static final int TableRow03=0x7f070047; public static final int TextView01=0x7f070003; public static final int TextView02=0x7f070004; - public static final int btnChannelDown=0x7f07004f; - public static final int btnChannelUp=0x7f07004c; - public static final int btnExit=0x7f070050; - public static final int btnHibernate=0x7f070052; - public static final int btnRestart=0x7f070053; - public static final int btnShutOff=0x7f070054; - public static final int btnSuspend=0x7f070051; - public static final int btnVolumeDown=0x7f07004e; - public static final int btnVolumeMute=0x7f07004d; - public static final int btnVolumeUp=0x7f07004b; - public static final int btnWakeOnLan=0x7f070055; + public static final int btnChannelDown=0x7f070051; + public static final int btnChannelUp=0x7f07004e; + public static final int btnExit=0x7f070052; + public static final int btnHibernate=0x7f070054; + public static final int btnRestart=0x7f070055; + public static final int btnShutOff=0x7f070056; + public static final int btnSuspend=0x7f070053; + public static final int btnVolumeDown=0x7f070050; + public static final int btnVolumeMute=0x7f07004f; + public static final int btnVolumeUp=0x7f07004d; + public static final int btnWakeOnLan=0x7f070057; public static final int btn_main_music=0x7f070008; public static final int btn_main_now_playing=0x7f07000b; public static final int btn_main_pictures=0x7f070007; @@ -120,75 +121,76 @@ public static final int btn_main_skp_back=0x7f07000e; public static final int btn_main_skp_forw=0x7f070010; public static final int btn_main_video=0x7f070009; - public static final int btnkey01=0x7f070057; - public static final int btnkey02=0x7f070058; - public static final int btnkey03=0x7f070059; - public static final int btnkey04=0x7f07005a; - public static final int btnkey05=0x7f07005b; - public static final int btnkey06=0x7f07005c; - public static final int btnkey07=0x7f07005d; - public static final int btnkey08=0x7f07005e; - public static final int btnkey09=0x7f07005f; - public static final int btnkey10=0x7f070060; - public static final int btnkey11=0x7f070062; - public static final int btnkey12=0x7f070063; - public static final int btnkey13=0x7f070064; - public static final int btnkey14=0x7f070065; - public static final int btnkey15=0x7f070066; - public static final int btnkey16=0x7f070067; - public static final int btnkey17=0x7f070068; - public static final int btnkey18=0x7f070069; - public static final int btnkey19=0x7f07006a; - public static final int btnkey20=0x7f07006c; - public static final int btnkey21=0x7f07006d; - public static final int btnkey22=0x7f07006e; - public static final int btnkey23=0x7f07006f; - public static final int btnkey24=0x7f070070; - public static final int btnkey25=0x7f070071; - public static final int btnkey26=0x7f070072; - public static final int btnkey27=0x7f070073; - public static final int btnkey28=0x7f070074; - public static final int btnkey29=0x7f070076; - public static final int btnkey30=0x7f070077; - public static final int btnkey31=0x7f070078; - public static final int btnkey32=0x7f070079; - public static final int btnkey33=0x7f07007a; - public static final int btnkey41=0x7f07007c; - public static final int btnkey42=0x7f07007d; - public static final int btnkey43=0x7f07007e; - public static final int btnkey44=0x7f07007f; - public static final int btnkey45=0x7f070080; - public static final int btnkey46=0x7f070081; - public static final int btnkey47=0x7f070082; - public static final int btnkey48=0x7f070083; - public static final int btnkey49=0x7f070084; - public static final int btnkey50=0x7f070085; - public static final int button_play=0x7f07001d; - public static final int button_stream=0x7f07001b; - public static final int clearplaylist=0x7f07008d; - public static final int crtl_back=0x7f070038; - public static final int crtl_ch_m=0x7f070044; - public static final int crtl_ch_p=0x7f07003f; - public static final int crtl_down=0x7f070037; - public static final int crtl_full=0x7f070041; - public static final int crtl_info=0x7f070049; - public static final int crtl_left=0x7f070032; - public static final int crtl_menu=0x7f070043; - public static final int crtl_mp=0x7f07002e; - public static final int crtl_osd=0x7f070048; - public static final int crtl_parent=0x7f070036; - public static final int crtl_play=0x7f070042; - public static final int crtl_power=0x7f070030; - public static final int crtl_ratio=0x7f070047; - public static final int crtl_right=0x7f070034; - public static final int crtl_select=0x7f070033; - public static final int crtl_skip_back=0x7f07003c; - public static final int crtl_skip_forw=0x7f07003e; - public static final int crtl_stop=0x7f07003d; - public static final int crtl_sub=0x7f070046; - public static final int crtl_up=0x7f07002f; - public static final int crtl_vol_m=0x7f07003a; - public static final int crtl_vol_p=0x7f070039; + public static final int btnkey01=0x7f070059; + public static final int btnkey02=0x7f07005a; + public static final int btnkey03=0x7f07005b; + public static final int btnkey04=0x7f07005c; + public static final int btnkey05=0x7f07005d; + public static final int btnkey06=0x7f07005e; + public static final int btnkey07=0x7f07005f; + public static final int btnkey08=0x7f070060; + public static final int btnkey09=0x7f070061; + public static final int btnkey10=0x7f070062; + public static final int btnkey11=0x7f070064; + public static final int btnkey12=0x7f070065; + public static final int btnkey13=0x7f070066; + public static final int btnkey14=0x7f070067; + public static final int btnkey15=0x7f070068; + public static final int btnkey16=0x7f070069; + public static final int btnkey17=0x7f07006a; + public static final int btnkey18=0x7f07006b; + public static final int btnkey19=0x7f07006c; + public static final int btnkey20=0x7f07006e; + public static final int btnkey21=0x7f07006f; + public static final int btnkey22=0x7f070070; + public static final int btnkey23=0x7f070071; + public static final int btnkey24=0x7f070072; + public static final int btnkey25=0x7f070073; + public static final int btnkey26=0x7f070074; + public static final int btnkey27=0x7f070075; + public static final int btnkey28=0x7f070076; + public static final int btnkey29=0x7f070078; + public static final int btnkey30=0x7f070079; + public static final int btnkey31=0x7f07007a; + public static final int btnkey32=0x7f07007b; + public static final int btnkey33=0x7f07007c; + public static final int btnkey41=0x7f07007e; + public static final int btnkey42=0x7f07007f; + public static final int btnkey43=0x7f070080; + public static final int btnkey44=0x7f070081; + public static final int btnkey45=0x7f070082; + public static final int btnkey46=0x7f070083; + public static final int btnkey47=0x7f070084; + public static final int btnkey48=0x7f070085; + public static final int btnkey49=0x7f070086; + public static final int btnkey50=0x7f070087; + public static final int button_open=0x7f07001c; + public static final int button_stream=0x7f07001d; + public static final int button_stream_stop=0x7f07001e; + public static final int clearplaylist=0x7f070094; + public static final int crtl_back=0x7f07003a; + public static final int crtl_ch_m=0x7f070046; + public static final int crtl_ch_p=0x7f070041; + public static final int crtl_down=0x7f070039; + public static final int crtl_full=0x7f070043; + public static final int crtl_info=0x7f07004b; + public static final int crtl_left=0x7f070034; + public static final int crtl_menu=0x7f070045; + public static final int crtl_mp=0x7f070030; + public static final int crtl_osd=0x7f07004a; + public static final int crtl_parent=0x7f070038; + public static final int crtl_play=0x7f070044; + public static final int crtl_power=0x7f070032; + public static final int crtl_ratio=0x7f070049; + public static final int crtl_right=0x7f070036; + public static final int crtl_select=0x7f070035; + public static final int crtl_skip_back=0x7f07003e; + public static final int crtl_skip_forw=0x7f070040; + public static final int crtl_stop=0x7f07003f; + public static final int crtl_sub=0x7f070048; + public static final int crtl_up=0x7f070031; + public static final int crtl_vol_m=0x7f07003c; + public static final int crtl_vol_p=0x7f07003b; public static final int full_text=0x7f070018; public static final int icon_image=0x7f070001; public static final int icon_text=0x7f070002; @@ -198,38 +200,43 @@ public static final int list_song=0x7f070016; public static final int main_now_playing=0x7f07000d; public static final int music_grid=0x7f070012; - public static final int naviRemote_text=0x7f07004a; - public static final int now_album=0x7f070020; - public static final int now_artist=0x7f070026; - public static final int now_cd=0x7f070021; - public static final int now_list=0x7f07002b; - public static final int now_next=0x7f07002a; - public static final int now_play=0x7f070029; - public static final int now_playing=0x7f07001f; - public static final int now_playing_right=0x7f070024; - public static final int now_playing_t_left=0x7f070023; - public static final int now_prev=0x7f070027; - public static final int now_progress=0x7f070022; - public static final int now_stop=0x7f070028; - public static final int now_title=0x7f070025; - public static final int open=0x7f070090; - public static final int playlist=0x7f07008c; - public static final int progress_bar=0x7f07001c; - public static final int rslide=0x7f070093; - public static final int save=0x7f07008f; - public static final int sdcard=0x7f07008e; - public static final int send=0x7f070091; - public static final int server_ip=0x7f070086; - public static final int server_macid=0x7f070088; - public static final int server_port=0x7f070087; - public static final int slide=0x7f070092; + public static final int naviRemote_text=0x7f07004c; + public static final int now_album=0x7f070022; + public static final int now_artist=0x7f070028; + public static final int now_cd=0x7f070023; + public static final int now_list=0x7f07002d; + public static final int now_next=0x7f07002c; + public static final int now_play=0x7f07002b; + public static final int now_playing=0x7f070021; + public static final int now_playing_right=0x7f070026; + public static final int now_playing_t_left=0x7f070025; + public static final int now_prev=0x7f070029; + public static final int now_progress=0x7f070024; + public static final int now_stop=0x7f07002a; + public static final int now_title=0x7f070027; + public static final int open=0x7f070097; + public static final int playlist=0x7f070093; + public static final int radio01=0x7f07008e; + public static final int radio02=0x7f07008f; + public static final int radio03=0x7f070090; + public static final int radio04=0x7f070091; + public static final int radioStop=0x7f070092; + public static final int rslide=0x7f07009a; + public static final int save=0x7f070096; + public static final int sdcard=0x7f070095; + public static final int send=0x7f070098; + public static final int server_ip=0x7f070088; + public static final int server_macid=0x7f07008a; + public static final int server_port=0x7f070089; + public static final int slide=0x7f070099; public static final int text_kb_streamed=0x7f07001a; - public static final int title=0x7f07008b; - public static final int vibration=0x7f07008a; + public static final int title=0x7f07008d; + public static final int txtFile=0x7f07001b; + public static final int vibration=0x7f07008c; public static final int widget0=0x7f070011; - public static final int widget00=0x7f07002d; - public static final int widget01=0x7f070031; - public static final int widget02=0x7f070035; + public static final int widget00=0x7f07002f; + public static final int widget01=0x7f070033; + public static final int widget02=0x7f070037; public static final int widget44=0x7f070000; } public static final class layout { @@ -254,6 +261,7 @@ public static final int setup=0x7f030012; public static final int splash=0x7f030013; public static final int title=0x7f030014; + public static final int webradio=0x7f030015; } public static final class menu { public static final int music_menu=0x7f060000; Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/readme =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/readme 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/readme 2011-01-13 21:02:08 UTC (rev 4070) @@ -24,7 +24,8 @@ Video section ------------- -nothing yet +play an initial file on startup +experimental stream / open file with preview NowPlaying ---------- Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/player.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/player.xml 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/player.xml 2011-01-13 21:02:08 UTC (rev 4070) @@ -5,21 +5,25 @@ <TextView android:id="@+id/text_kb_streamed" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:textStyle="bold" android:text="Streaming .mp3 Audio Tutorial" /> + android:textStyle="bold" android:text="Streaming files experimental"/> - <Button android:id="@+id/button_stream" android:layout_width="wrap_content" - android:layout_height="wrap_content" android:layout_marginTop="10px" - style="?android:attr/buttonStyleSmall" android:text="Start Streaming" /> + <EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="@+id/txtFile" android:id="@+id/txtFile" android:inputType="text" android:layout_marginTop="10dip"></EditText> + + <Button android:id="@+id/button_open" android:layout_height="wrap_content" android:layout_marginTop="10px" + style="?android:attr/buttonStyleSmall" android:text="Open stream" android:layout_width="fill_parent"/> + + <Button android:id="@+id/button_stream" android:layout_height="wrap_content" android:layout_marginTop="10px" + style="?android:attr/buttonStyleSmall" android:text="Start streaming" android:layout_width="fill_parent"/> + + <Button android:id="@+id/button_stream_stop" android:layout_height="wrap_content" android:layout_marginTop="10px" + style="?android:attr/buttonStyleSmall" android:text="Stop streaming" android:layout_width="fill_parent"/> - <ProgressBar android:id="@+id/progress_bar" - android:layout_width="200px" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - style="?android:attr/progressBarStyleHorizontal" /> + - <ImageButton android:id="@+id/button_play" - android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="5px" style="?android:attr/buttonStyleSmall" - android:src="@drawable/pause" /> + +<SurfaceView android:id="@+id/SurfaceView01" android:layout_width="300dip" android:layout_height="200dip" android:layout_marginTop="10dip"></SurfaceView> + + </LinearLayout> \ No newline at end of file Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote01.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote01.xml 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote01.xml 2011-01-13 21:02:08 UTC (rev 4070) @@ -40,8 +40,7 @@ </LinearLayout> <LinearLayout android:id="@+id/widget02" - android:layout_height="wrap_content" android:layout_width="wrap_content" - android:layout_gravity="center_vertical"> + android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center_horizontal"> <ImageButton android:id="@+id/crtl_parent" android:layout_height="60dip" android:layout_width="100dip"> Added: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/webradio.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/webradio.xml (rev 0) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/webradio.xml 2011-01-13 21:02:08 UTC (rev 4070) @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" android:layout_width="fill_parent" + android:layout_height="fill_parent" android:background="@drawable/brush"> + +<Button android:text="Webradio 01" + android:id="@+id/radio01" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> +</Button> +<Button android:text="Webradio 02" + android:id="@+id/radio02" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> +</Button> +<Button android:text="Webradio 03" + android:id="@+id/radio03" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> +</Button> +<Button android:text="Webradio 04" + android:id="@+id/radio04" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> +</Button> + +<Button android:text="Stop Playing" + android:id="@+id/radioStop" + android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_marginTop="20dip"> +</Button> + +</LinearLayout> \ No newline at end of file Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MediaPlayerControl.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MediaPlayerControl.java 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MediaPlayerControl.java 2011-01-13 21:02:08 UTC (rev 4070) @@ -2,69 +2,85 @@ import java.io.IOException; +import mediaportal.remote.communication.SendCommand; import mediaportal.remote.utils.AppSettings; import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; -import android.provider.Contacts.Settings; -import android.util.Log; +import android.view.SurfaceHolder; +import android.view.SurfaceView; import android.view.View; import android.widget.Button; -import android.widget.ImageButton; -import android.widget.ProgressBar; import android.widget.TextView; -public class MediaPlayerControl extends Activity { +public class MediaPlayerControl extends Activity implements + SurfaceHolder.Callback { + private Button openButton; private Button streamButton; - private ImageButton playButton; - private TextView textStreamed; + private Button streamStopButton; - private MediaPlayer mp; - - private boolean isPlaying; - - private StreamingMediaPlayer audioStreamer; - - @Override + private TextView txtFile; + + private SurfaceView mPreview; + private SurfaceHolder holder; + + private static MediaPlayer mp; + + @Override public void onCreate(Bundle icicle) { - - super.onCreate(icicle); - setContentView(R.layout.player); - initControls(); - - mp = new MediaPlayer(); - } - - private void initControls() { - textStreamed = (TextView) findViewById(R.id.text_kb_streamed); + super.onCreate(icicle); + + setContentView(R.layout.player); + initControls(); + } + + private void initControls() { + + txtFile = (TextView) findViewById(R.id.txtFile); + txtFile.setText(AppSettings.getLastFile()); + + openButton = (Button) findViewById(R.id.button_open); streamButton = (Button) findViewById(R.id.button_stream); + streamStopButton = (Button) findViewById(R.id.button_stream_stop); + + mPreview = (SurfaceView) findViewById(R.id.SurfaceView01); + + // Set a size for the video screen + holder = mPreview.getHolder(); + holder.addCallback(this); + holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + holder.setFixedSize(300, 200); + + openButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + SendCommand.PostStreamFile(txtFile.getText().toString(),"video"); + } + }); + streamButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { - startStreamingAudio(); - }}); + if (mp == null) + mp = new MediaPlayer(); + startStreaming(); + } + }); - playButton = (ImageButton) findViewById(R.id.button_play); - playButton.setEnabled(false); - playButton.setOnClickListener(new View.OnClickListener() { + streamStopButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { - if (audioStreamer.getMediaPlayer().isPlaying()) { - audioStreamer.getMediaPlayer().pause(); - playButton.setImageResource(R.drawable.play); - } else { - audioStreamer.getMediaPlayer().start(); - audioStreamer.startPlayProgressUpdater(); - playButton.setImageResource(R.drawable.pause); - } - isPlaying = !isPlaying; - }}); - } - - private void startStreamingAudio() { - - try { - mp.setDataSource("rtsp://" + AppSettings.getServer() +"/stream.sdp"); + closePlayer(); + } + }); + + } + + private void startStreaming() { + + try { + mp.setDataSource("rtsp://" + AppSettings.getServer() + + ":5554/android.sdp"); + mp.setDisplay(holder); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -75,7 +91,7 @@ // TODO Auto-generated catch block e.printStackTrace(); } - try { + try { mp.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block @@ -84,7 +100,37 @@ // TODO Auto-generated catch block e.printStackTrace(); } - mp.start(); - - } + mp.start(); + mp.setScreenOnWhilePlaying(true); + } + + public void surfaceCreated(SurfaceHolder surfaceholder) { + + } + + public void surfaceChanged(SurfaceHolder surfaceholder, int i, int j, int k) { + + } + + public void surfaceDestroyed(SurfaceHolder surfaceholder) { + + } + + @Override + protected void onPause() { + super.onPause(); + + closePlayer(); + + AppSettings.setLastFile(txtFile.getText().toString()); + } + + private void closePlayer() { + if (mp != null) { + if (mp.isPlaying()) + mp.stop(); + mp = null; + + } + } } Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/StreamingMediaPlayer.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/StreamingMediaPlayer.java 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/StreamingMediaPlayer.java 2011-01-13 21:02:08 UTC (rev 4070) @@ -1,335 +0,0 @@ -package mediaportal.remote; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import android.content.Context; -import android.media.MediaPlayer; -import android.os.Handler; -import android.util.Log; -import android.widget.Button; -import android.widget.ImageButton; -import android.widget.ProgressBar; -import android.widget.TextView; - -/** - * MediaPlayer does not yet support streaming from external URLs so this class provides a pseudo-streaming function - * by downloading the content incrementally & playing as soon as we get enough audio in our temporary storage. - */ -public class StreamingMediaPlayer { - - private static final int INTIAL_KB_BUFFER = 160*10/8;//assume 96kbps*10secs/8bits per byte - - private TextView textStreamed; - - private ImageButton playButton; - - private ProgressBar progressBar; - - // Track for display by progressBar - private long mediaLengthInKb, mediaLengthInSeconds; - private int totalKbRead = 0; - - // Create Handler to call View updates on the main UI thread. - private final Handler handler = new Handler(); - - private MediaPlayer mediaPlayer; - - private File downloadingMediaFile; - - private boolean isInterrupted; - - private Context context; - - private int counter = 0; - - public StreamingMediaPlayer(Context context,TextView textStreamed, ImageButton playButton, Button streamButton,ProgressBar progressBar) - { - this.context = context; - this.textStreamed = textStreamed; - this.playButton = playButton; - this.progressBar = progressBar; - } - - /** - * Progressively download the media to a temporary location and update the MediaPlayer as new content becomes available. - */ - public void startStreaming(final String mediaUrl, long mediaLengthInKb, long mediaLengthInSeconds) throws IOException { - - this.mediaLengthInKb = mediaLengthInKb; - this.mediaLengthInSeconds = mediaLengthInSeconds; - - Runnable r = new Runnable() { - public void run() { - try { - downloadAudioIncrement(mediaUrl); - } catch (IOException e) { - Log.e(getClass().getName(), "Unable to initialize the MediaPlayer for fileUrl=" + mediaUrl, e); - return; - } - } - }; - new Thread(r).start(); - } - - /** - * Download the url stream to a temporary location and then call the setDataSource - * for that local file - */ - public void downloadAudioIncrement(String mediaUrl) throws IOException { - - URLConnection cn = new URL(mediaUrl).openConnection(); - cn.connect(); - InputStream stream = cn.getInputStream(); - if (stream == null) { - Log.e(getClass().getName(), "Unable to create InputStream for mediaUrl:" + mediaUrl); - } - - downloadingMediaFile = new File(context.getCacheDir(),"downloadingMedia.dat"); - - // Just in case a prior deletion failed because our code crashed or something, we also delete any previously - // downloaded file to ensure we start fresh. If you use this code, always delete - // no longer used downloads else you'll quickly fill up your hard disk memory. Of course, you can also - // store any previously downloaded file in a separate data cache for instant replay if you wanted as well. - if (downloadingMediaFile.exists()) { - downloadingMediaFile.delete(); - } - - FileOutputStream out = new FileOutputStream(downloadingMediaFile); - byte buf[] = new byte[16384]; - int totalBytesRead = 0, incrementalBytesRead = 0; - do { - int numread = stream.read(buf); - if (numread <= 0) - break; - out.write(buf, 0, numread); - totalBytesRead += numread; - incrementalBytesRead += numread; - totalKbRead = totalBytesRead/1000; - - testMediaBuffer(); - fireDataLoadUpdate(); - } while (validateNotInterrupted()); - stream.close(); - if (validateNotInterrupted()) { - fireDataFullyLoaded(); - } - } - - private boolean validateNotInterrupted() { - if (isInterrupted) { - if (mediaPlayer != null) { - mediaPlayer.pause(); - //mediaPlayer.release(); - } - return false; - } else { - return true; - } - } - - - /** - * Test whether we need to transfer buffered data to the MediaPlayer. - * Interacting with MediaPlayer on non-main UI thread can causes crashes to so perform this using a Handler. - */ - private void testMediaBuffer() { - Runnable updater = new Runnable() { - public void run() { - if (mediaPlayer == null) { - // Only create the MediaPlayer once we have the minimum buffered data - if ( totalKbRead >= INTIAL_KB_BUFFER) { - try { - startMediaPlayer(); - } catch (Exception e) { - Log.e(getClass().getName(), "Error copying buffered conent.", e); - } - } - } else if ( mediaPlayer.getDuration() - mediaPlayer.getCurrentPosition() <= 1000 ){ - // NOTE: The media player has stopped at the end so transfer any existing buffered data - // We test for < 1second of data because the media player can stop when there is still - // a few milliseconds of data left to play - transferBufferToMediaPlayer(); - } - } - }; - handler.post(updater); - } - - private void startMediaPlayer() { - try { - File bufferedFile = new File(context.getCacheDir(),"playingMedia" + (counter++) + ".dat"); - - // We double buffer the data to avoid potential read/write errors that could happen if the - // download thread attempted to write at the same time the MediaPlayer was trying to read. - // For example, we can't guarantee that the MediaPlayer won't open a file for playing and leave it locked while - // the media is playing. This would permanently deadlock the file download. To avoid such a deadloack, - // we move the currently loaded data to a temporary buffer file that we start playing while the remaining - // data downloads. - moveFile(downloadingMediaFile,bufferedFile); - - Log.e(getClass().getName(),"Buffered File path: " + bufferedFile.getAbsolutePath()); - Log.e(getClass().getName(),"Buffered File length: " + bufferedFile.length()+""); - - mediaPlayer = createMediaPlayer(bufferedFile); - - // We have pre-loaded enough content and started the MediaPlayer so update the buttons & progress meters. - mediaPlayer.start(); - startPlayProgressUpdater(); - playButton.setEnabled(true); - } catch (IOException e) { - Log.e(getClass().getName(), "Error initializing the MediaPlayer.", e); - return; - } - } - - private MediaPlayer createMediaPlayer(File mediaFile) - throws IOException { - MediaPlayer mPlayer = new MediaPlayer(); - mPlayer.setOnErrorListener( - new MediaPlayer.OnErrorListener() { - public boolean onError(MediaPlayer mp, int what, int extra) { - Log.e(getClass().getName(), "Error in MediaPlayer: (" + what +") with extra (" +extra +")" ); - return false; - } - }); - - // It appears that for security/permission reasons, it is better to pass a FileDescriptor rather than a direct path to the File. - // Also I have seen errors such as "PVMFErrNotSupported" and "Prepare failed.: status=0x1" if a file path String is passed to - // setDataSource(). So unless otherwise noted, we use a FileDescriptor here. - FileInputStream fis = new FileInputStream(mediaFile); - mPlayer.setDataSource(fis.getFD()); - mPlayer.prepare(); - return mPlayer; - } - - /** - * Transfer buffered data to the MediaPlayer. - * NOTE: Interacting with a MediaPlayer on a non-main UI thread can cause thread-lock and crashes so - * this method should always be called using a Handler. - */ - private void transferBufferToMediaPlayer() { - try { - // First determine if we need to restart the player after transferring data...e.g. perhaps the user pressed pause - boolean wasPlaying = mediaPlayer.isPlaying(); - int curPosition = mediaPlayer.getCurrentPosition(); - - // Copy the currently downloaded content to a new buffered File. Store the old File for deleting later. - File oldBufferedFile = new File(context.getCacheDir(),"playingMedia" + counter + ".dat"); - File bufferedFile = new File(context.getCacheDir(),"playingMedia" + (counter++) + ".dat"); - - // This may be the last buffered File so ask that it be delete on exit. If it's already deleted, then this won't mean anything. If you want to - // keep and track fully downloaded files for later use, write caching code and please send me a copy. - bufferedFile.deleteOnExit(); - moveFile(downloadingMediaFile,bufferedFile); - - // Pause the current player now as we are about to create and start a new one. So far (Android v1.5), - // this always happens so quickly that the user never realized we've stopped the player and started a new one - mediaPlayer.pause(); - - // Create a new MediaPlayer rather than try to re-prepare the prior one. - mediaPlayer = createMediaPlayer(bufferedFile); - mediaPlayer.seekTo(curPosition); - - // Restart if at end of prior buffered content or mediaPlayer was previously playing. - // NOTE: We test for < 1second of data because the media player can stop when there is still - // a few milliseconds of data left to play - boolean atEndOfFile = mediaPlayer.getDuration() - mediaPlayer.getCurrentPosition() <= 1000; - if (wasPlaying || atEndOfFile){ - mediaPlayer.start(); - } - - // Lastly delete the previously playing buffered File as it's no longer needed. - oldBufferedFile.delete(); - - }catch (Exception e) { - Log.e(getClass().getName(), "Error updating to newly loaded content.", e); - } - } - - private void fireDataLoadUpdate() { - Runnable updater = new Runnable() { - public void run() { - textStreamed.setText((totalKbRead + " Kb read")); - float loadProgress = ((float)totalKbRead/(float)mediaLengthInKb); - progressBar.setSecondaryProgress((int)(loadProgress*100)); - } - }; - handler.post(updater); - } - - private void fireDataFullyLoaded() { - Runnable updater = new Runnable() { - public void run() { - transferBufferToMediaPlayer(); - - // Delete the downloaded File as it's now been transferred to the currently playing buffer file. - downloadingMediaFile.delete(); - textStreamed.setText(("Audio full loaded: " + totalKbRead + " Kb read")); - } - }; - handler.post(updater); - } - - public MediaPlayer getMediaPlayer() { - return mediaPlayer; - } - - public void startPlayProgressUpdater() { - float progress = (((float)mediaPlayer.getCurrentPosition()/1000)/mediaLengthInSeconds); - progressBar.setProgress((int)(progress*100)); - - if (mediaPlayer.isPlaying()) { - Runnable notification = new Runnable() { - public void run() { - startPlayProgressUpdater(); - } - }; - handler.postDelayed(notification,1000); - } - } - - public void interrupt() { - playButton.setEnabled(false); - isInterrupted = true; - validateNotInterrupted(); - } - - /** - * Move the file in oldLocation to newLocation. - */ - public void moveFile(File oldLocation, File newLocation) - throws IOException { - - if ( oldLocation.exists( )) { - BufferedInputStream reader = new BufferedInputStream( new FileInputStream(oldLocation) ); - BufferedOutputStream writer = new BufferedOutputStream( new FileOutputStream(newLocation, false)); - try { - byte[] buff = new byte[8192]; - int numChars; - while ( (numChars = reader.read( buff, 0, buff.length ) ) != -1) { - writer.write( buff, 0, numChars ); - } - } catch( IOException ex ) { - throw new IOException("IOException when transferring " + oldLocation.getPath() + " to " + newLocation.getPath()); - } finally { - try { - if ( reader != null ){ - writer.close(); - reader.close(); - } - } catch( IOException ex ){ - Log.e(getClass().getName(),"Error closing files when transferring " + oldLocation.getPath() + " to " + newLocation.getPath() ); - } - } - } else { - throw new IOException("Old location does not exist when transferring " + oldLocation.getPath() + " to " + newLocation.getPath() ); - } - } -} Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/communication/SendCommand.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/communication/SendCommand.java 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/communication/SendCommand.java 2011-01-13 21:02:08 UTC (rev 4070) @@ -167,4 +167,23 @@ post.Post(xml); } + public static void PostStreamFile(String Filename, String MediaTyp) { + + Filename = Entity.AddEntity(Filename); + + Log.d("MediaPortal", "PostStreamFile : " + Filename); + + PostWebserver post = new PostWebserver(AppSettings.getServer(), AppSettings.getPort()); + String xml = ""; + + xml += "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"; + xml += "<message>\r\n"; + xml += "<command>StreamFile</command>\r\n"; + xml += "<filename>" + Filename + "</filename>\r\n"; + xml += "<mediatyp>" + MediaTyp + "</mediatyp>\r\n"; + xml += "</message>\r\n"; + + post.Post(xml); + } + } Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2011-01-13 21:02:08 UTC (rev 4070) @@ -30,6 +30,7 @@ import mediaportal.remote.R; import mediaportal.remote.communication.SendCommand; import mediaportal.remote.control.Remote_01; +import mediaportal.remote.multimedia.Webradio; import mediaportal.remote.music.MusicTab; import mediaportal.remote.nowPlaying.NowPlaying; import mediaportal.remote.nowPlaying.NowPlayingXmlHandler; @@ -52,6 +53,7 @@ import android.os.Handler; import android.os.Vibrator; import android.util.Log; +import android.view.KeyEvent; import android.view.View; import android.widget.*; @@ -146,13 +148,13 @@ public void onClick(View view) { Vibration.vibrateShort(); - Toast.makeText(view.getContext(), - "not implemented yet. Sorry !", Toast.LENGTH_LONG) - .show(); + //Toast.makeText(view.getContext(), + // "not implemented yet. Sorry !", Toast.LENGTH_LONG) + // .show(); - //Intent myIntent = new Intent(view.getContext(), - //MediaPlayerControl.class); - //startActivity(myIntent); + Intent myIntent = new Intent(view.getContext(), + MediaPlayerControl.class); + startActivity(myIntent); } }); @@ -179,7 +181,7 @@ btnSettings.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Vibration.vibrateShort(); - Intent myIntent = new Intent(view.getContext(), Setup.class); + Intent myIntent = new Intent(view.getContext(), Webradio.class); startActivity(myIntent); } }); @@ -281,7 +283,7 @@ super.onStart(); Log.d("MediaPortal", "start Main"); - + AppSettings.setSettings(getSharedPreferences(PREFS_PRIVATE, MODE_PRIVATE)); @@ -292,11 +294,6 @@ } @Override - public void onResume() { - super.onResume(); - } - - @Override public void onPause() { super.onPause(); @@ -304,6 +301,21 @@ mHandler.removeCallbacks(mUpdateTimeTask); } + // hardware keys + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + + switch (keyCode) { + case KeyEvent.KEYCODE_MENU: { + Intent myIntent = new Intent(this, Setup.class); + startActivityForResult(myIntent, 0); + return true; + } + } + + return super.onKeyDown(keyCode, event); + } + private Runnable mUpdateTimeTask = new Runnable() { public void run() { new update().execute(); @@ -333,8 +345,8 @@ if ((playerState != null) && (!playerState.equals("no player active"))) { display = values.get("Artist") + " - " - + values.get("Title") + " (" + values.get("ActualTime") - + ")"; + + values.get("Title") + " (" + + values.get("ActualTime") + ")"; state = playerState; } else { display = "nothing playing"; Added: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/multimedia/AudioPlayer.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/multimedia/AudioPlayer.java (rev 0) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/multimedia/AudioPlayer.java 2011-01-13 21:02:08 UTC (rev 4070) @@ -0,0 +1,47 @@ +package mediaportal.remote.multimedia; + +import java.io.IOException; + +import mediaportal.remote.utils.AppSettings; +import android.media.MediaPlayer; + +public class AudioPlayer { + + private MediaPlayer mp; + + public AudioPlayer() { + mp = new MediaPlayer(); + } + + public void StartPlaying() { + try { + mp.setDataSource("http://" + AppSettings.getServer() + ":8081/"); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalStateException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + mp.prepare(); + } catch (IllegalStateException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + mp.start(); + mp.setScreenOnWhilePlaying(true); + } + + public void StopPlaying() { + if (mp != null) + if (mp.isPlaying()) + mp.stop(); + } +} Added: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/multimedia/Webradio.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/multimedia/Webradio.java (rev 0) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/multimedia/Webradio.java 2011-01-13 21:02:08 UTC (rev 4070) @@ -0,0 +1,84 @@ +package mediaportal.remote.multimedia; + +import mediaportal.remote.R; +import mediaportal.remote.communication.SendCommand; +import mediaportal.remote.utils.KeyLock; +import mediaportal.remote.utils.Vibration; +import android.app.Activity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class Webradio extends Activity{ + + private AudioPlayer player; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.webradio); + + player = new AudioPlayer(); + + Button radio01 = (Button) findViewById(R.id.radio01); + radio01.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + Vibration.vibrateShort(); + + SendCommand.PostStreamFile("webradio_1","audio"); + player.StartPlaying(); + } + }); + Button radio02 = (Button) findViewById(R.id.radio02); + radio02.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + Vibration.vibrateShort(); + + SendCommand.PostStreamFile("webradio_2","audio"); + player.StartPlaying(); + } + }); + Button radio03 = (Button) findViewById(R.id.radio03); + radio03.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + Vibration.vibrateShort(); + + SendCommand.PostStreamFile("webradio_3","audio"); + player.StartPlaying(); + } + }); + Button radio04 = (Button) findViewById(R.id.radio04); + radio04.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + Vibration.vibrateShort(); + + SendCommand.PostStreamFile("webradio_4","audio"); + player.StartPlaying(); + } + }); + + Button radioStop = (Button) findViewById(R.id.radioStop); + radioStop.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + Vibration.vibrateShort(); + player.StopPlaying(); + } + }); + + } + + @Override + public void onResume() { + super.onResume(); + + KeyLock.disableKeylock(); + } + + @Override + public void onPause() { + super.onPause(); + + KeyLock.enbleKeylock(); + + } +} Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures/Picturesfullscreen.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures/Picturesfullscreen.java 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures/Picturesfullscreen.java 2011-01-13 21:02:08 UTC (rev 4070) @@ -69,6 +69,8 @@ public static boolean SlideshowPaused = false; private static long SlideInterval = 5000; + private Bitmap picture; + /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { @@ -105,7 +107,7 @@ Log.d("MediaPortal", "pictures fullscreen load " + file); - item.Picture = http.DownloadImage(file); + picture = http.DownloadImage(file); } return null; @@ -119,7 +121,7 @@ if (item.isFolder != true) { ImageView imagev = (ImageView) findViewById(R.id.ImageView01); - imagev.setImageBitmap(item.Picture); + imagev.setImageBitmap(picture); TextView txt = (TextView) findViewById(R.id.full_text); @@ -174,10 +176,10 @@ HttpHandler handler = new HttpHandler(); - Bitmap pic = handler.DownloadImage(req); + picture = handler.DownloadImage(req); ImageView imagev = (ImageView) findViewById(R.id.ImageView01); - imagev.setImageBitmap(pic); + imagev.setImageBitmap(picture); TextView txt = (TextView) findViewById(R.id.full_text); txt.setText("Random slide show"); @@ -220,7 +222,7 @@ private void SavetoSDCard() { try { DirItems item = Pictures.pictureList.get(Pictures.selectedPicture); - Bitmap bMap = item.Picture; + Bitmap bMap = picture; File fPath = Environment.getExternalStorageDirectory(); OutputStream outStream = null; try { @@ -249,7 +251,7 @@ Picturesfullscreen.this, fPath + "/" + item.File.toString(), "image/jpeg"); - Toast.makeText(Picturesfullscreen.this, "File saved.", + Toast.makeText(Picturesfullscreen.this, "File has been saved.", Toast.LENGTH_SHORT).show(); } catch (IOException e) { e.printStackTrace(); @@ -267,7 +269,7 @@ private void SavetoCache() { try { DirItems item = Pictures.pictureList.get(Pictures.selectedPicture); - Bitmap bMap = item.Picture; + Bitmap bMap = picture; File fPath = Environment.getExternalStorageDirectory(); OutputStream outStream = null; try { @@ -291,8 +293,8 @@ try { outStream.close(); - Toast.makeText(Picturesfullscreen.this, "File saved.", - Toast.LENGTH_SHORT).show(); + //Toast.makeText(Picturesfullscreen.this, "File saved.", + // Toast.LENGTH_SHORT).show(); } catch (IOException e) { e.printStackTrace(); Log.e("Debug", "SavetoSDCard " + e.getMessage().toString() Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/utils/AppSettings.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/utils/AppSettings.java 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/utils/AppSettings.java 2011-01-13 21:02:08 UTC (rev 4070) @@ -60,6 +60,11 @@ return "http://" + AppSettings.getServer() + ":" + AppSettings.getPort(); } + public static String getLastFile() + { + return settings.getString("LastFile", "c:\\test.mp4"); + } + public static void setServer(String Server) { prefEditor.putString("Server", Server); @@ -86,4 +91,10 @@ prefEditor.commit(); } + public static void setLastFile(String File) + { + prefEditor.putString("LastFile", File); + prefEditor.commit(); + } + } Modified: trunk/plugins/AndroidRemote/Release/AndroidRemote.xmp2 =================================================================== --- trunk/plugins/AndroidRemote/Release/AndroidRemote.xmp2 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Release/AndroidRemote.xmp2 2011-01-13 21:02:08 UTC (rev 4070) @@ -17,6 +17,13 @@ <ZipFileName>Installer{CopyFile}\{e035a37f-6b89-423d-b478-a1d7bbd1cce6}-AndroidRemote.dll</ZipFileName> <DestinationFilename>%Plugins%\process\AndroidRemote.dll</DestinationFilename> </FileItem> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>OverwriteIfOlder</UpdateOption> + <LocalFileName>..\Server\AndroidRemote\bin\Release\VideoLan.Interop.dll</LocalFileName> + <ZipFileName>Installer{CopyFile}\{b71d0b6b-5613-449f-98a4-50dee3c65c8c}-VideoLan.Interop.dll</ZipFileName> + <DestinationFilename>%Plugins%\process\VideoLan.Interop.dll</DestinationFilename> + </FileItem> </Items> </Files> </GroupItem> @@ -193,6 +200,13 @@ <ZipFileName>Installer{CopyFile}\{e035a37f-6b89-423d-b478-a1d7bbd1cce6}-AndroidRemote.dll</ZipFileName> <DestinationFilename>%Plugins%\process\AndroidRemote.dll</DestinationFilename> </FileItem> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>OverwriteIfOlder</UpdateOption> + <LocalFileName>..\Server\AndroidRemote\bin\Release\VideoLan.Interop.dll</LocalFileName> + <ZipFileName>Installer{CopyFile}\{b71d0b6b-5613-449f-98a4-50dee3c65c8c}-VideoLan.Interop.dll</ZipFileName> + <DestinationFilename>%Plugins%\process\VideoLan.Interop.dll</DestinationFilename> + </FileItem> </Items> </UniqueFileList> <ProjectSettings> Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj =================================================================== --- trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidRemote.csproj 2011-01-13 21:02:08 UTC (rev 4070) @@ -52,10 +52,18 @@ <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath> <Private>False</Private> </Reference> + <Reference Include="VideoLan.Interop, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <Private>False</Private> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="AndroidServer.cs" /> - <Compile Include="ExecuteCommand.cs" /> + <Compile Include="Content\MusicHandler.cs" /> + <Compile Include="Content\NowPlayingHandler.cs" /> + <Compile Include="Content\PictureHandler.cs" /> + <Compile Include="SocketHandler.cs" /> + <Compile Include="Content\SomeUtils.cs" /> + <Compile Include="Content\ExecuteCommand.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Request.cs" /> <Compile Include="Setup.cs"> Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs =================================================================== --- trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs 2011-01-10 20:32:55 UTC (rev 4069) +++ trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs 2011-01-13 21:02:08 UTC (rev 4070) @@ -34,6 +34,8 @@ using System.Net; using System.Net.Sockets; +using VideoLan; + namespace AndroidRemote { [PluginIcons("AndroidRemote.icon.png", "AndroidRemote.icon_off.png")] @@ -43,10 +45,13 @@ private TcpListener myListener; public static string Server = string.Empty; public static string Port = string.Empty; + public static string VlcFile = string.Empty; private Thread listen; private Thread grabPictures; + public static VideoLan.VlcControl vlc; + #region IPlugin public void Start() { @@... [truncated message content] |