question

tifr0z avatar image
tifr0z asked

Help w/ Custom player discovery using the Fling SDK

In view of developing an iOS video app that will be using a custom player, I am prototyping a Fling app with an iOS controller based on a slightly modified version of the 'FlingSample' (The iOS controller provided with the SDK) along with a slightly modified version of the 'CustomPlayerSample' (The custom player). I am running into multiple issues with which the doc or the sample code provided haven't been helpful so far: 1. After resetting everything (i.e. after restarting the fireTV stick I am using for development, and restarting the iOS controller from scratch), the service for the custom player is not found at all. See screenshot at https://s3.amazonaws.com/web.swishly.com/shared/IMG_7060.PNG. >>> My question is: how do I make the custom player service discoverable under these circumstances? 2. The custom player service is found after connecting to the default player service, then restarting the controller app. However at this stage the custom player service's name is blank: see at https://s3.amazonaws.com/web.swishly.com/shared/IMG_7036.PNG >>> My question is: how does one set the name of the custom player? 3. Maybe I am working off of the wrong material? Is there a better way to experiment with a Fling iOS controller with a custom player that would avoid the pitfalls of working with modified samples that were written with slightly different use cases in mind (In particular, 'FlingSample' is meant to demonstrate how to use a controller with the default player, not with a custom player) Thanks in advance!
fire tv
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

memo@amazon avatar image
memo@amazon answered
Hello, You are indeed following the expected development path (modifying the samples to prove concept and building on it). The CustomMediaPlayer and FlingSample should be modified as you described in https://forums.developer.amazon.com/forums/thread.jspa?threadID=9868&tstart=0 . As long as you can verify that you are initializing the DiscoveryController like this: [self.controller searchPlayerWithId:@" your.custom.service.id" andListener:self]; All the devices added will be of that type. The names displayed are the friendly names of the Fire TV/stick devices. The empty string for name is puzzling - one possibility might be due to your custom player being deployed on an Android tablet. Could that be possible? Thanks
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tifr0z avatar image
tifr0z answered
Hi, thanks for the reply First let me confirm that yes, I am using "[self.controller searchPlayerWithId:@"com.swishly.webtv.fireosplayer" andListener:self];" in the controller, and I checked about 100 times that the identical string is used for the Custom Player's SID I am using a fireTV stick for development/testing, but I even tested with a borrowed fire TV and I obtained the exact same results. Let me try to summarize below what I have tried and what I found out: 1. The device itself is not the issue (tested with 2 distinct devices, 1 fire tv and 1 stick, and reproduced the exact same behavior) 2. Most likely the issue resides with the Custom Player, because I reproduced essentially the same symptoms using an Android controller derived from the 'CastWithFlingExample' sample, going against the same Custom Player. 3. Translating the controller logs in human-readable language, the story is as follow: a. After the 'Hugues' service is successfully discovered & selected, connection is initiated but never completes (-(void)connected is never called) b. Shortly after the connection attempt is initiated, a new service with no name is discovered c. At this stage the controller is busted, but if you restart the controller you will see both services show up. If the user selects the service with no name, the [connected] delegate method is called and the connection successfully completes. On the other hand, if the user selects the 'Hugues' service, the connection is initiated but never completes. d. An error shows up in the Custom Player's logs after the first connection attempt is initiated (but never completes, see 3.a). I can't make much of the error but hopefully this will be meaningful to you: 12-03 17:44:21.377 22017-22698/com.swishly.webtv.fireosplayer E/WhisperLink﹕ PlatformCoreManager - Failed to start service router for udp, secure=true 12-03 17:44:21.377 22017-22698/com.swishly.webtv.fireosplayer E/WhisperLink﹕ PlatformCoreManager - Failed to start service router for udp, secure=false My conclusion at this point is that the Bonjour services are not being advertised properly by the Custom Player. I am post the code/config for the PlayerService and the whisperplay.xml below. Please note that I wrote a trivial version of the Custom Player after hitting a dead-end with the 'CustomPlayerSample', so the package names are not the same as in 'CustomPlayerSample', however the observed behavior is exactly the same ------------------------ whisperplay.xml ------------------------------- com.swishly.webtv.fireosplayer ALL com.swishly.webtv.fireosplayer.WebTVPlayerService ------------------------- Player Service ---------------------------- package com.swishly.webtv.fireosplayer; import android.os.IBinder; [import ...] public class WebTVPlayerService extends MediaPlayerHostService { private static final String TAG = "WebTVPlayerService"; private static final String WEBTV_PLAYER_SERVICE_ID = "com.swishly.webtv.fireosplayer"; // Create the media player implementation that will handle remote method invocations @Override public CustomMediaPlayer createServiceImplementation() { Log.i(TAG, "createServiceImplementation()"); return new WebTVPlayer(this); } // Communicate the unique service identifier (SID) of your player app @Override public String getPlayerId() { Log.i(TAG, "getPlayerId()"); return WEBTV_PLAYER_SERVICE_ID; } @Override public IBinder onBind(Intent intent) { return null; } } Message was edited by: tifr0z
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tifr0z avatar image
tifr0z answered
A couple additional data points: * A screenshot of the android studio device picker, as evidence that I am running the Custom Player on a FireTV device: https://s3.amazonaws.com/web.swishly.com/shared/Screen+Shot+2015-12-06+at+4.19.18+PM.png * The logs show that the failure to connect from the 'Hugues' service results from the TWhisperLinkTransport disconnecting immediately after the connection is accepted by the Custom Player (see below for details). Unfortunately the logs don't say why the connection gets disconnected Here are some extracts from the logs: >>>>> For a successful connection (from the service with a blank name) 12-04 17:31:32.706 6980-7602/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Incoming connection from Device: 2e90c389D847D08EE3C44244BA3E9BFE to Service: com.swishly.webtv.fireosplayer Connection Id: ios_4063 Channel: inet 12-04 17:31:32.706 6980-7602/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Connection accepted for: sid: com.swishly.webtv.fireosplayer UUID: 2e90c389D847D08EE3C44244BA3E9BFE Device Type: 0 Connection Id: ios_4063 Channel: inet 12-04 17:31:32.716 6980-8315/com.swishly.webtv.fireosplayer W/WhisperLink﹕ DiscoveryManager - Remote device has no routes :2e90c389D847D08EE3C44244BA3E9BFE 12-04 17:31:32.716 6980-8315/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TThreadPoolServiceRouter: INET: - Forwarding connection to Service: com.swishly.webtv.fireosplayer from Device: 2e90c389D847D08EE3C44244BA3E9BFE Connection Id: ios_4063 Channel: inet 12-04 17:31:32.716 6980-8315/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Initiating connection to Service: com.swishly.webtv.fireosplayer Connection Id: ios_4063 Channel: inet 12-04 17:31:32.747 6980-7605/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Incoming connection from Device: 2e90c389D847D08EE3C44244BA3E9BFE to Service: com.swishly.webtv.fireosplayer Connection Id: ios_4063 Channel: inet 12-04 17:31:32.757 6980-7605/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Connection accepted for: sid: com.swishly.webtv.fireosplayer UUID: 2e90c389D847D08EE3C44244BA3E9BFE Device Type: 0 Connection Id: ios_4063 Channel: inet 12-04 17:31:32.757 6980-8320/com.swishly.webtv.fireosplayer I/WhisperLink﹕ WPServer - WorkerProcess: Starting UUID: 2e90c389D847D08EE3C44244BA3E9BFE Service Id: com.swishly.webtv.fireosplayer, Connection Id: ios_4063 Channel: inet 12-04 17:31:32.827 6980-8320/com.swishly.webtv.fireosplayer D/ProxyPlayerService﹕ addStatusCallback - mCallbackCountMap added. cb=DeviceCallback(device:Device(friendlyName:Sample Client Device, uuid:2e90c389D847D08EE3C44244BA3E9BFE, deviceType:0, exInfo:ExtendedInfo(deviceClassMajor:, deviceClassMinor:, manufacturer:Darwin, model:iPhone7,2, OSMajor:, OSMinor:, capabilities:Dictionary(version:0, entries:{FlingSDKVersion=1.2.1})), routes:{inet=Route(hardwareAddr:, ipv4:10.0.1.2, unsecurePort:61459, securePort:61460)}, accountHint:), callbackService:Description(sid:cb_415650083, friendlyName:, accessLevel:0, security:0, flags:0, version:0), commChannelId:unx) 12-04 17:31:32.827 6980-8320/com.swishly.webtv.fireosplayer V/MetricsServiceConnection﹕ getService : Sent intent to bind to metrics service. Service will be bound asynchronously. >>>>> Failed connection attempt (From the 'Hugues' service) 12-04 17:37:32.847 13337-14465/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Incoming connection from Device: 2e90c389D847D08EE3C44244BA3E9BFE to Service: amzn.dmgr Connection Id: ios_3683 Channel: inet 12-04 17:37:32.847 13337-14465/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Connection accepted for: sid: amzn.dmgr UUID: 2e90c389D847D08EE3C44244BA3E9BFE Device Type: 0 Connection Id: ios_3683 Channel: inet 12-04 17:37:32.847 13337-14642/com.swishly.webtv.fireosplayer W/WhisperLink﹕ DiscoveryManager - Remote device has no routes :2e90c389D847D08EE3C44244BA3E9BFE 12-04 17:37:32.847 13337-14642/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TThreadPoolServiceRouter: INET: - Forwarding connection to Service: amzn.dmgr from Device: 2e90c389D847D08EE3C44244BA3E9BFE Connection Id: ios_3683 Channel: inet 12-04 17:37:32.847 13337-14642/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Initiating connection to Service: amzn.dmgr Connection Id: ios_3683 Channel: inet 12-04 17:37:32.937 13337-14460/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Incoming connection from Device: 2e90c389D847D08EE3C44244BA3E9BFE to Service: amzn.dmgr Connection Id: ios_3683 Channel: inet 12-04 17:37:32.937 13337-14460/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Connection accepted for: sid: amzn.dmgr UUID: 2e90c389D847D08EE3C44244BA3E9BFE Device Type: 0 Connection Id: ios_3683 Channel: inet 12-04 17:37:32.937 13337-14647/com.swishly.webtv.fireosplayer I/WhisperLink﹕ WPServer - WorkerProcess: Starting UUID: 2e90c389D847D08EE3C44244BA3E9BFE Service Id: amzn.dmgr, Connection Id: ios_3683 Channel: inet /*************** THIS IS WHERE THINGS START GOING SIDEWAYS ******************/ 12-04 17:37:32.977 13337-14648/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Closing connection for Service: amzn.dmgr isClient: true Connection Id: ios_3683 Channel: inet 12-04 17:37:32.977 13337-14647/com.swishly.webtv.fireosplayer I/WhisperLink﹕ WPServer - WorkerProcess: Closing UUID: 2e90c389D847D08EE3C44244BA3E9BFE Service Id: amzn.dmgr, Connection Id: ios_3683 Channel: inet 12-04 17:37:32.977 13337-14648/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Closing connection for Service: amzn.dmgr isClient: false Connection Id: ios_3683 Channel: inet 12-04 17:37:32.977 13337-14647/com.swishly.webtv.fireosplayer I/WhisperLink﹕ TWhisperLinkTransport - Closing connection for Service: amzn.dmgr isClient: false Connection Id: ios_3683 Channel: inet
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.