Tuesday, 1 December 2020

Does Chromecast support RTP?

AFAIK chromecast doesnt support RTP but when I connect my one plus one to chromecast I got following log, so how is it casting?

09-15 16:07:37.648 815-815/? I/MediaRouterService: Selected global route:Route cast409 (com.google.android.gms/.cast.media.CastRemoteDisplayProviderService:c5d0e5d940851c488853a91b1635cfde)
09-15 16:07:37.659 255-2209/? W/APM::AudioPolicyManager: releaseOutput() releasing unknown output 320
09-15 16:07:37.661 815-837/? D/WifiService: acquireWifiLockLocked: WifiLock{CastMediaRouteProvider type=1 binder=android.os.BinderProxy@5381e83}
09-15 16:07:37.661 815-2665/? E/native: do suspend false
09-15 16:07:37.661 815-1554/? I/WifiDisplayController: Stopping Wifi display scan.
09-15 16:07:37.662 2694-2694/? I/wpa_supplicant: P2P-FIND-STOPPED 
09-15 16:07:37.663 815-815/? I/MediaRouterService: Connecting to global route: Route cast409 (com.google.android.gms/.cast.media.CastRemoteDisplayProviderService:c5d0e5d940851c488853a91b1635cfde)
09-15 16:07:37.664 3028-3028/? D/ChimeraResource: Successfully parsed resource with package name: com.google.android.gms and resource name drawable/ic_notification_cast_connecting
09-15 16:07:37.669 255-2211/? D/audio_hw_primary: out_set_parameters: enter: usecase(4: audio-ull-playback) kvpairs: routing=2
09-15 16:07:37.679 255-2211/? D/audio_hw_primary: start_output_stream: enter: stream(0xb5fb6fc0)usecase(4: audio-ull-playback) devices(0x2)
09-15 16:07:37.679 255-2211/? D/audio_hw_primary: start_output_stream: enter: usecase(4: audio-ull-playback) devices(0x2)
09-15 16:07:37.679 255-2211/? E/audio_hw_primary: voice_extn_compress_voip_is_active: COMPRESS_VOIP_ENABLED is not defined
09-15 16:07:37.679 255-2211/? E/msm8974_platform: voice_extn_compress_voip_is_active: COMPRESS_VOIP_ENABLED is not defined
09-15 16:07:37.680 255-2211/? D/audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: )
09-15 16:07:37.680 255-2211/? W/msm8974_platform: Codec backend bitwidth 16, samplerate 48000
09-15 16:07:37.680 255-2211/? D/hardware_info: hw_info_append_hw_type : device_name = speaker
09-15 16:07:37.680 255-2211/? I/msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(15)
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 15, path =  0
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_adm_topology
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_asm_topology
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_audtable
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TABLE
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_audvoltable
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_GAIN_DEP_STEP_TABLE


                                             [ 09-15 16:07:37.680   255: 2211 D/         ]
                                             Failed to fetch the lookup information of the device 0000000F 
09-15 16:07:37.680 255-2211/? E/ACDB-LOADER: Error: ACDB AudProc vol returned = -19
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_VOL_CAL
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> send_afe_cal
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_COMMON_TABLE


                                             [ 09-15 16:07:37.680   255: 2211 D/         ]
                                             Failed to fetch the lookup information of the device 0000000F 
09-15 16:07:37.680 255-2211/? E/ACDB-LOADER: Error: ACDB AFE returned = -19
09-15 16:07:37.680 255-2211/? D/ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL
09-15 16:07:37.686 255-2211/? D/audio_hw_primary: select_devices: done
09-15 16:07:37.837 3028-13759/? I/CastDeviceController: [controller-0006 MRP] calling Listener.onConnected(true)
09-15 16:07:37.845 3028-13759/? I/CastDeviceController: [controller-0006 MRP] launchApplicationInternal. id=674A0243, options=LaunchOptions(relaunchIfRunning=true, language=en-US)
09-15 16:07:37.845 4374-4518/? D/DeviceConnectionService: client connected with version: 9452000
09-15 16:07:38.216 3028-4268/? I/CastMediaRouteProvider: CastDeviceController.Listener.onApplicationConnected: appId=674A0243, sessionId=729D062D-A72C-4D5A-92FA-84CAEE580C8F
09-15 16:07:38.219 3028-3028/? I/MirroringControlChannel: [instance-6] offer string; {"udpPort":2346,"supportedStreams":[{"index":0,"type":"audio_source","codecName":"aac","rtpProfile":"cast","rtpPayloadType":127,"ssrc":1,"storeTime":100,"targetDelay":100,"bitRate":128000,"sampleRate":48000,"timeBase":"1\/48000","channels":2,"rtpExtensions":["adaptive_playout_delay"],"receiverRtcpEventLog":true,"aesKey":"33ef675ea7ce18414c584ecdcfc4b442","aesIvMask":"216e2d585125e768cb6ede391a7b21f8","errorRecoveryMode":"castv2"},{"index":1,"type":"video_source","codecName":"h264","rtpProfile":"cast","rtpPayloadType":96,"ssrc":11,"storeTime":100,"targetDelay":100,"maxFrameRate":"60000\/1001","timeBase":"1\/90000","maxBitRate":6000000,"profile":"main","level":"4","resolutions":[{"height":720,"width":1280}],"rtpExtensions":["adaptive_playout_delay"],"receiverRtcpEventLog":true,"aesKey":"33ef675ea7ce18414c584ecdcfc4b442","aesIvMask":"216e2d585125e768cb6ede391a7b21f8","errorRecoveryMode":"castv2","intraRefreshEnable":false}]}
09-15 16:07:38.454 3028-3028/? W/CastRouteController: [instance-6] createSourceOrSink, flags = 0x80000000
09-15 16:07:38.455 3028-27897/? I/JGCastService: enable TDLS on source
09-15 16:07:38.456 3028-27897/? I/GCastSource: config = '
09-15 16:07:38.457 3028-27897/? I/GCastSource: {
09-15 16:07:38.457 3028-27897/? I/GCastSource:   "extraData": {
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "maxBitrate": 6000,
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "maxFramerate": "60000\/1001",
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "minLatency": 100,
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "receiverProductName": "Chromecast",
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "receiverVersion": "5",
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "resolution": "1280x720",
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "senderBuild": "MHC19Q",
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "senderGmsCoreVersion": 9452000,
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "senderModel": "A0001",
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "senderPlatform": "Android",
09-15 16:07:38.457 3028-27897/? I/GCastSource:       "senderVersion": "6.0.1"
09-15 16:07:38.457 3028-27897/? I/GCastSource:     },
09-15 16:07:38.457 3028-27897/? I/GCastSource:   "maxTargetDelay": 500,
09-15 16:07:38.457 3028-27897/? I/GCastSource:   "remoteFriendlyName": "cast409",
09-15 16:07:38.457 3028-27897/? I/GCastSource:   "sendFormats": [
09-15 16:07:38.457 3028-27897/? I/GCastSource:       {
09-15 16:07:38.457 3028-27897/? I/GCastSource:         "aes-iv-mask": [redacted],
09-15 16:07:38.457 3028-27897/? I/GCastSource:         "aes-key": [redacted],
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "bit_rate": 128000,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "channels": 2,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "codec_name": "aac_ld_adts",
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "index": 0,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "receiver_events": true,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "remote_rtp_port": 49794,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "remote_ssrc": 2,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "rtp_extensions": [
09-15 16:07:38.458 3028-27897/? I/GCastSource:             "adaptive_playout_delay"
09-15 16:07:38.458 3028-27897/? I/GCastSource:           ],
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "rtp_payload_type": 127,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "rtp_port": 2346,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "rtp_profile": "cast",
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "sample_rate": 48000,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "ssrc": 1,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "store_time": 100,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "time_base": 48000,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "type": "audio_source"
09-15 16:07:38.458 3028-27897/? I/GCastSource:       },
09-15 16:07:38.458 3028-27897/? I/GCastSource:       {
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "aes-iv-mask": [redacted],
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "aes-key": [redacted],
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "codec_name": "h264",
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "error_recovery_mode": "castv2",
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "index": 1,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "key_frame_refresh_interval": 60,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "max_bit_rate": 6000000,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "max_frame_rate": "60000\/1001",
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "receiver_events": true,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "remote_rtp_port": 49794,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "remote_ssrc": 12,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "resolutions": [
09-15 16:07:38.458 3028-27897/? I/GCastSource:             {
09-15 16:07:38.458 3028-27897/? I/GCastSource:               "height": 720,
09-15 16:07:38.458 3028-27897/? I/GCastSource:               "width": 1280
09-15 16:07:38.458 3028-27897/? I/GCastSource:             }
09-15 16:07:38.458 3028-27897/? I/GCastSource:           ],
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "rtp_extensions": [
09-15 16:07:38.458 3028-27897/? I/GCastSource:             "adaptive_playout_delay"
09-15 16:07:38.458 3028-27897/? I/GCastSource:           ],
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "rtp_payload_type": 96,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "rtp_port": 2346,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "rtp_profile": "cast",
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "ssrc": 11,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "store_time": 100,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "time_base": 90000,
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "type": "video_source",
09-15 16:07:38.458 3028-27897/? I/GCastSource:         "use_intra_macroblock_cyclic_mode": false
09-15 16:07:38.458 3028-27897/? I/GCastSource:       }
09-15 16:07:38.458 3028-27897/? I/GCastSource:     ]
09-15 16:07:38.458 3028-27897/? I/GCastSource: }
09-15 16:07:38.458 3028-27897/? I/GCastSource: '
09-15 16:07:38.458 3028-27897/? I/GCastSource: Connecting to receiver: cast409
09-15 16:07:38.458 3028-27897/? I/GCastSource: increasing video delay to 100 ms, max unacked 6
09-15 16:07:38.459 3028-27897/? I/GCastSource: encrypting video.
09-15 16:07:38.459 3028-27897/? I/GCastSource: Using ADTS
09-15 16:07:38.459 3028-27897/? I/GCastSource: increasing audio delay to 100 ms, max unacked 16
09-15 16:07:38.459 3028-27897/? I/GCastSource: encrypting audio.
09-15 16:07:38.459 3028-27897/? I/GCastSource: connecting RTP from 0.0.0.0:2346 to 192.168.1.6:49794
09-15 16:07:38.459 3028-27897/? I/NetworkSession: socket 134 listening to 0.0.0.0:2346
09-15 16:07:38.460 2694-2694/? I/wpa_supplicant: TDLS: Failed to send message (action_code=10)
09-15 16:07:38.461 2694-2694/? I/wpa_supplicant: TDLS: Creating peer entry for 6c:ad:f8:8b:d0:26
09-15 16:07:38.463 3028-27897/? I/Converter: initEncoder, mOutputFormat - AMessage(what = 0x00000000) = {
                                               string error_recovery_mode = "castv2"
                                               int32_t use_intra_macroblock_cyclic_mode = 0
                                               string mime = "video/avc"
                                               int32_t key_frame_refresh_interval = 60
                                               int32_t width = 1280
                                               int32_t height = 720
                                               int32_t max-bitrate = 6000000
                                               float max-fps-to-encoder = 59.940060
                                               int32_t bitrate = 3000000
                                               int32_t store-metadata-in-buffers = 1
                                               int32_t color-format = 2130708361
                                               int64_t repeat-previous-frame-after = 70000
                                               int64_t max-pts-gap-to-encoder = 33333
                                             }
09-15 16:07:38.466 3028-27901/? I/OMXClient: Using client-side OMX mux.
09-15 16:07:38.470 3028-27897/? I/Converter: using video bitrate of 3000000 bps
09-15 16:07:38.470 3028-27897/? I/Converter: Optmized for quality/video - not using IntraRefreshCyclic
09-15 16:07:38.471 255-12601/? E/OMXNodeInstance: getParameter(55:qcom.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)
09-15 16:07:38.472 255-2219/? W/OMXNodeInstance: [55:qcom.encoder.avc] component does not support metadata mode; using fallback
09-15 16:07:38.472 3028-27901/? E/ACodec: [OMX.qcom.video.encoder.avc] storeMetaDataInBuffers (output) failed w/ err -1010
09-15 16:07:38.472 3028-27901/? W/ACodec: do not know color format 0x7fa30c04 = 2141391876
09-15 16:07:38.472 3028-27901/? W/ACodec: do not know color format 0x7f000789 = 2130708361
09-15 16:07:38.474 3028-27901/? I/FFMPEGSoftCodec: Decoder will be in frame by frame mode
09-15 16:07:38.477 3028-27901/? I/ACodec: setupVideoEncoder succeeded
09-15 16:07:38.478 3028-27901/? W/ACodec: do not know color format 0x7f000789 = 2130708361
09-15 16:07:38.482 255-2219/? E/OMXNodeInstance: getParameter(55:qcom.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)
09-15 16:07:38.494 255-255/? D/r_submix: adev_open_input_stream(addr=0)
09-15 16:07:38.495 255-255/? D/r_submix:  Non-NULL shut down sink when opening input stream, releasing, refcount=4
09-15 16:07:38.495 255-255/? D/r_submix: submix_audio_device_release_pipe_l(idx=9) addr=0
09-15 16:07:38.495 255-255/? D/r_submix: submix_audio_device_create_pipe_l(addr=0, idx=9)
09-15 16:07:38.495 255-255/? D/r_submix:   now using address 0 for route 9
09-15 16:07:38.495 255-27909/? I/AudioFlinger: AudioFlinger's thread 0xad940000 ready to run
09-15 16:07:38.495 255-27909/? I/r_submix: in_standby()
09-15 16:07:38.496 255-27909/? I/r_submix: in_standby()
09-15 16:07:38.498 3028-27897/? I/Converter: initEncoder, mOutputFormat - AMessage(what = 0x00000000) = {
                                               string mime = "audio/mp4a-latm"
                                               int32_t sample-rate = 48000
                                               int32_t channel-count = 2
                                               int32_t bitrate = 128000
                                               int32_t max-input-size = 7680
                                             }
09-15 16:07:38.499 3028-27910/? I/OMXClient: Using client-side OMX mux.
09-15 16:07:38.579 3028-27897/? I/Converter: using audio bitrate of 128000 bps
09-15 16:07:38.583 255-12601/? I/AudioFlinger: openOutput(), module 12 Device 8000, SamplingRate 48000, Format 0x000001, Channels 3, flags 0
09-15 16:07:38.583 255-12601/? D/r_submix: adev_open_output_stream(address=0)
09-15 16:07:38.583 255-12601/? D/r_submix: submix_audio_device_create_pipe_l(addr=0, idx=9)
09-15 16:07:38.583 255-12601/? D/r_submix:   now using address 0 for route 9
09-15 16:07:38.583 255-12601/? I/AudioFlinger: AudioStreamOut::open(), mHalFormatIsLinearPcm = 1
09-15 16:07:38.583 255-12601/? I/AudioFlinger: HAL output buffer size 1024 frames, normal sink buffer size 1024 frames
09-15 16:07:38.584 255-27918/? I/AudioFlinger: AudioFlinger's thread 0xadb40000 ready to run
09-15 16:07:38.585 255-27918/? I/r_submix: out_standby()
09-15 16:07:38.587 255-12601/? I/AudioFlinger: HAL output buffer size 1024 frames, normal sink buffer size 1024 frames
09-15 16:07:38.588 255-27919/? I/AudioFlinger: AudioFlinger's thread 0xadbc0000 ready to run
09-15 16:07:38.597 255-2208/? D/audio_hw_primary: adev_set_parameters: enter: 0=;connect=32768
09-15 16:07:38.597 255-2208/? E/voice: voice_extn_compress_voip_set_parameters: COMPRESS_VOIP_ENABLED is not defined
09-15 16:07:38.597 255-2208/? E/bt_a2dp_hw: adev_set_parameters: ERROR: set param called even when stream out is null
09-15 16:07:38.599 815-4743/? I/DisplayManagerService: Display device added: DisplayDeviceInfo{"cast409": uniqueId="virtual:com.google.android.gms,10018,cast409,0", 1280 x 720, modeId 7, defaultModeId 7, supportedModes [{id=7, width=1280, height=720, fps=60.0}], colorTransformId 0, defaultColorTransformId 0, supportedColorTransforms [], density 213, 213.0 x 213.0 dpi, appVsyncOff 0, presDeadline 16666666, touch NONE, rotation 0, type VIRTUAL, state ON, owner com.google.android.gms (uid 10018), FLAG_SECURE, FLAG_PRESENTATION}
09-15 16:07:38.606 815-3564/? D/WifiService: acquireWifiLockLocked: WifiLock{CastMirroringProvider type=1 binder=android.os.BinderProxy@7d24f56}
09-15 16:07:38.607 3028-3028/? D/CastMirroringProvider: No Notifier
09-15 16:07:38.607 815-2665/? E/native: do suspend false
09-15 16:07:38.607 815-3560/? D/WifiService: acquireWifiLockLocked: WifiLock{CastRemoteDisplayProvider type=1 binder=android.os.BinderProxy@b3c2bd7}
09-15 16:07:38.607 815-2665/? E/native: do suspend false
09-15 16:07:38.608 3028-3028/? D/ChimeraResource: Successfully parsed resource with package name: com.google.android.gms and resource name drawable/ic_notification_cast_on
09-15 16:07:38.608 815-815/? I/MediaRouterService: Connected to global route: Route cast409 (com.google.android.gms/.cast.media.CastRemoteDisplayProviderService:c5d0e5d940851c488853a91b1635cfde)
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: EGL information:
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: vendor    : Android
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: version   : 1.4 Android META-EGL
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: extensions: EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time EGL_KHR_swap_buffers_with_damage EGL_KHR_image EGL_KHR_image_base EGL_KHR_lock_surface EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_fence_sync EGL_KHR_create_context EGL_EXT_create_context_robustness EGL_ANDROID_image_native_buffer EGL_KHR_wait_sync EGL_ANDROID_recordable EGL_KHR_partial_update 
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: Client API: OpenGL_ES
09-15 16:07:38.625 245-245/? I/SurfaceFlinger: EGLSurface: 8-8-8-8, config=0x5
09-15 16:07:38.643 3028-27897/? I/GCastBase: updating NTP offset, accuracy +/- 2931 us

Update

With respect to Ali Naddaf answer my concern is, that I thought the same way but when you record video using mediacodec and muxer api, its moov atom is not written at the beginning of the file, so is unplayable until recording is finished(i.e can't be streamed), then how inbuilt app is creating and streaming at the same time, also if you check the logs it heavily mentions RTP keyword what is that?

I asked the question for the creating file using muxer earlier but answer are not satisfactory BTW here is the previous question link

Android Mediamuxer moov atom

Also tried Presentation API demo but it crashed https://github.com/googlecast/CastRemoteDisplay-android

EDIT for those Presentation demo not working, demo will not work with CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID

you have to create APP id from https://cast.google.com/publish



from Does Chromecast support RTP?

Typescript library: Hide internal exports

I am building a library in typescript that is being published via npm.

In the index.ts, which is the starting point of the library, all the public classes and enums are exported.

import { MyClass } from './internal/my-class'
import { MyEnum } from './internal/my-enum'
export { MyClass, MyEnum }

This works well, but I noticed that users are able to import internal functions/classes etc. as well by using a direct path to the file.

// in a project that installed my library as an npm dependency
import { InternalClass } from 'my-lib/dist/internal/internal-class'

Is there a way to prevent this?

I need to "export" InternalClass because I'm importing and using it throughout my library, but I don't want to expose it publicly. I tried using namespaces, but couldn't really get it to work.



from Typescript library: Hide internal exports

Flutter "Add 2 App" Android integration with adjustments to generated .android

I'm working on an Android app with 3+ years of Kotlin development and want to gradually migrate it to Flutter feature-by-feature. I use option B of the "add 2 app" integration where I depend on the module's source code. Features written Flutter are integrated into the native Android app with FlutterActivity or FlutterFragment. This worked great for the first feature however now I have an issue with migrating the second feature. The second feature requires the packages camera and firebase_ml_vision. Now the problem is that camera requires a min SDK of 21 but the generated Android code in .android sets the min SDK to 16. Additionally firebase_ml_vision requires initialization of Firebase which also needs to be added to .android. I'm thinking about adding .android to VCS and add the required changes however this is generated code. It gets removed when flutter clean is called and generated on flutter pub get. I would have to constantly adjust the generated code when Flutter changes/removes it :( .android only hosts the "skeleton" Android app which is started when the Flutter project is run from IDE (or command line). It is not the host app (the old, native app) where Firebase is already configured. However the .android app is used for quick development cycles. If I cannot use this anymore because of said limitations, I would always have to start the native Android app (host) and lose many benefits of Flutter like hot reload :( Has anyone come across the same problem?

Update:

In this article they clearly state that .android should not be modified or added to VCS. They even mention the camera module as an example. However this does not work and can be reproduced with a few simple steps:

  1. Create a new module: flutter create --template=module --project-name example
  2. cd example
  3. Add camera plugin to pubspec.yaml
  4. flutter pub get
  5. Now running flutter build apk results in the following error:
/Users/sven/Development/example/.android/app/src/main/AndroidManifest.xml Error:
        uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:camera] /Users/sven/.pub-cache/hosted/pub.dartlang.org/camera-0.5.8+11/android/build/intermediates/library_manifest/release/AndroidManifest.xml as the library might be using APIs not available in 16
        Suggestion: use a compatible library with a minSdk of at most 16,
                or increase this project's minSdk version to at least 21,
                or use tools:overrideLibrary="io.flutter.plugins.camera" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:camera] /Users/sven/.pub-cache/hosted/pub.dartlang.org/camera-0.5.8+11/android/build/intermediates/library_manifest/release/AndroidManifest.xml as the library might be using APIs not available in 16
        Suggestion: use a compatible library with a minSdk of at most 16,
                or increase this project's minSdk version to at least 21,
                or use tools:overrideLibrary="io.flutter.plugins.camera" to force usage (may lead to runtime failures)


from Flutter "Add 2 App" Android integration with adjustments to generated .android